Qt 설정 버튼 아이콘
13287 단어 qtQPushButton
#include
#include
#include <QLabel> #include <QGridLayout> #include <QTextCodec> int main(int argc, char *argv[]) { QApplication app(argc, argv); // QTextCodec::setCodecForCStrings(QTextCodec::codecForName("gb2312")); QTextCodec::setCodecForLocale(QTextCodec::codecForName("gb2312")); QTextCodec::setCodecForTr( QTextCodec::codecForName("gb2312")); QWidget *widget = new QWidget(); widget->setFixedSize(800, 600); widget->move(200,200); QPixmap *pixmap = NULL; pixmap = new QPixmap(200, 150); pixmap->load(":/castle.jpg"); QIcon *icon = new QIcon(*pixmap); QPushButton *button = new QPushButton(*icon, "", widget); // , , // , button->setIconSize(QSize(190, 150)); button->setFixedSize(200, 150); QLabel *label = new QLabel(widget); QLabel *label1=new QLabel(widget); label->setPixmap(*pixmap); label->setFixedSize(200, 150); label1->setText("Qt "); // label1 label1->setStyleSheet("font-size : 53px"); // , , 。 //QFont font = app .font(); //font.setPointSize(53); //app.setFont(font); // label1 QPalette pe; pe.setColor(QPalette::WindowText,Qt::blue); label1->setPalette(pe); QGridLayout *layout=new QGridLayout; layout->addWidget(button,0,0); layout->addWidget(label,0,1); layout->addWidget(label1,1,0,2,1); widget->setLayout(layout); widget->showNormal(); return app.exec(); }이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Qt How to use connect between incompatible signal and slotIn this I want to call a function, that function will receive a point . But this function should be invoked by a timer's...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.