QPixmap pixmap;QPainter p(&pixmap);p.drawRect(10,10, 100,100);
imageLabel = new QLabel; imageLabel->setBackgroundRole(QPalette::Dark); imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); imageLabel->setScaledContents(true); scrollArea = new QScrollArea; scrollArea->setBackgroundRole(QPalette::Dark); scrollArea->setWidget(imageLabel); setCentralWidget(scrollArea); QImage image(file_image); imageLabel->setPixmap(QPixmap::fromImage(image)); scaleFactor = 1.0; actionFit_Window->setEnabled(true); updateActions(); if (!actionFit_Window->isChecked()) imageLabel->adjustSize();
QPainter painter; painter.begin( &image ); painter.fillRect(10,10, 100,100,QBrush(Color(190,190,190))); painter.drawRect(9,9,101,101); painter.end();
pixmap = QPixmap(":/background.png");QPainter paint;paint.begin(&pixmap);//собсна, рисование на paintpaint.end();QPainter paint(this);paint.drawPixmap(0, 0, pixmap);
imageLabel = new QLabel; imageLabel->setBackgroundRole(QPalette::Dark); imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); imageLabel->setScaledContents(true); scrollArea = new QScrollArea; scrollArea->setBackgroundRole(QPalette::Dark); scrollArea->setWidget(imageLabel); setCentralWidget(scrollArea); QImage image(file_image); QPainter painter; painter.begin( &image ); painter.fillRect(10,10, 100,100,QBrush(QColor(190,190,190))); painter.drawRect(9,9,101,101); painter.end(); imageLabel->setPixmap(QPixmap::fromImage(image)); scaleFactor = 1.0; actionFit_Window->setEnabled(true); updateActions(); if (!actionFit_Window->isChecked()) imageLabel->adjustSize();
imageLabel = new QLabel; imageLabel->setBackgroundRole(QPalette::Dark); imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); imageLabel->setScaledContents(true); scrollArea = new QScrollArea; scrollArea->setBackgroundRole(QPalette::Dark); scrollArea->setWidget(imageLabel); setCentralWidget(scrollArea); QImage image(file_image); QPixmap pix; pix=QPixmap::fromImage(image); QPainter painter; painter.begin(&pix); painter.fillRect(10,10, 100,100,QBrush(QColor(190,190,190))); painter.drawRect(9,9,101,101); painter.end(); imageLabel->setPixmap(pix); scaleFactor = 1.0; actionFit_Window->setEnabled(true); updateActions(); if (!actionFit_Window->isChecked()) imageLabel->adjustSize();