本文整理汇总了C++中QLabel::setPixmap方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setPixmap方法的具体用法?C++ QLabel::setPixmap怎么用?C++ QLabel::setPixmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::setPixmap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadXML
void WindowUser::ReadXML()
{
doc.LoadFile();
TiXmlNode *patr=doc.FirstChild();
int i=0;
while(patr){
int x,y;
TiXmlAttribute *atrX =patr->ToElement()->FirstAttribute();
TiXmlAttribute *atrY =patr->ToElement()->LastAttribute();
atrX->Next()->QueryIntValue(&x);
//cout<<x<<endl;
atrY->QueryIntValue(&y);
//cout<<y<<endl;
// cout<<patr->ToElement()->Attribute("Codigo")<<endl;
// cout<<patr->ToElement()->Attribute("X")<<endl;
// cout<<patr->ToElement()->Attribute("Y")<<endl;
QLabel *pin =new QLabel(this);
QPixmap qp=QPixmap(":/imgs/map-pin-md.png");
pin->setPixmap(qp);
pin->setGeometry(x,y,20,25);
pin->setScaledContents(true);
pin->raise();
pin->show();
patr=patr->NextSibling();
i++;
}
}
示例2: QWidget
QWidget *AppAboutPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
QVBoxLayout *layout = new QVBoxLayout(w);
layout->setSpacing(0);
layout->setMargin(0);
// Splash label
QWidget *sw = new QWidget(w);
QHBoxLayout *swLayout = new QHBoxLayout(sw);
sw->setLayout(swLayout);
QLabel *splash = new QLabel(w);
splash->setPixmap(theme()->splashScreenPixmap(settings()->path(Core::ISettings::SplashScreen)));
splash->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
swLayout->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding));
swLayout->addWidget(splash);
swLayout->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding));
layout->addWidget(sw);
QFrame *line = new QFrame(w);
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
layout->addWidget(line);
layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed));
// Welcome label
QLabel *label = new QLabel(w);
label->setWordWrap(true);
label->setOpenExternalLinks(true);
layout->addWidget(label);
layout->addSpacerItem(new QSpacerItem(20,20, QSizePolicy::Expanding, QSizePolicy::Expanding));
label->clear();
Utils::UpdateChecker *up = Core::ICore::instance()->updateChecker();
QString tmp = tkTr(Trans::Constants::APPLICATION_ABOUT_YEAR_1_WEB_2)
.arg(QDate::currentDate().year())
.arg(qApp->organizationDomain());
if (up->hasUpdate()) {
tmp.append(tkTr(Trans::Constants::UPDATE_AVAILABLE));
} else {
tmp.append(tkTr(Trans::Constants::VERSION_UPTODATE));
}
label->setText(tmp);
return w;
}
示例3: QHBoxLayout
TupBrushStatus::TupBrushStatus(const QString &label, const QPixmap &pix, bool bg)
{
background = bg;
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setMargin(2);
layout->setSpacing(2);
brush = new TupColorWidget;
connect(brush, SIGNAL(clicked()), this, SLOT(updateColour()));
QLabel *icon = new QLabel("");
icon->setToolTip(label);
icon->setPixmap(pix);
layout->addWidget(icon);
layout->addSpacing(3);
layout->addWidget(brush);
}
示例4: setMainWidgetTitle
ZAboutDialog::ZAboutDialog()
:MyBaseDlg()
{
setMainWidgetTitle ( "zCleaner" );
QString ProgDir = QString ( qApp->argv() [0] ) ;
int i = ProgDir.findRev ( "/" );
ProgDir.remove ( i+1, ProgDir.length() - i );
QWidget *myWidget = new QWidget ( this );
//myWidget->setGeometry(0,0,240,320);
QVBoxLayout *myVBoxLayout = new QVBoxLayout ( myWidget, 0 );
QHBoxLayout *myHBoxLayout = new QHBoxLayout;
myHBoxLayout->setSpacing ( 4 );
myHBoxLayout->setMargin ( 0 );
QLabel *myLabel = new QLabel ( myWidget );
myLabel->setPixmap ( QPixmap ( "folder.png" ) );
myLabel->setScaledContents ( false );
myHBoxLayout->addWidget ( myLabel );
myLabel = new QLabel ( QString ( "<qt><img src=%1/img/zCleaner_usr.png><br>"
"<qt>zCleaner 0.3 by c_ro87<br>" "<qt>Base GUI zGui 0.7.4g by BeZ<br>"
"<font size=\"-1\">zCleaner is a simple antivirus for Z6</font></qt>" ).arg(ProgDir), myWidget );
myHBoxLayout->addWidget ( myLabel, 1 );
myVBoxLayout->addLayout ( myHBoxLayout );
myLabel = new QLabel ( QString ( "<qt><font size=\"-1\"><p>Copyright (C) 2008 c_ro87<br>"
"<tt><[email protected]></tt><br></font></qt>" ),
myWidget );
myVBoxLayout->addWidget ( myLabel );
QSpacerItem* spacer = new QSpacerItem ( 8, 8, QSizePolicy::Minimum, QSizePolicy::Expanding );
myVBoxLayout->addItem ( spacer );
myLabel = new QLabel ( "www.modmymoto.com", myWidget );
myVBoxLayout->addWidget ( myLabel );
setContentWidget ( myWidget );
ZSoftKey *softKey = new ZSoftKey ( NULL, this, this );
softKey->setText ( ZSoftKey::LEFT, "OK", ( ZSoftKey::TEXT_PRIORITY ) 0 );
softKey->setClickedSlot ( ZSoftKey::LEFT, this, SLOT ( accept() ) );
setCSTWidget ( softKey );
}
示例5: main
int main(int argc, char *argv[]){
QApplication a(argc, argv);
QImage *im = new QImage(250,250,QImage::Format_RGB16);
QPainter p;
p.begin((QPaintDevice*)im);
p.setPen(QPen(QColor(100,100,100), 5, Qt::SolidLine, Qt::RoundCap,Qt::RoundJoin));
p.drawEllipse (10,10,50,50); // drawing code
p.end();
QLabel *label = new QLabel();
QPixmap *pix = new QPixmap(250,250);
pix->convertFromImage(*im);
label->setPixmap(*pix);
label->show();
return a.exec();
}
示例6: createToolBars
void BitcoinGUI::createToolBars()
{
QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
toolbar->setObjectName("toolbar");
addToolBar(Qt::LeftToolBarArea,toolbar);
toolbar->setOrientation(Qt::Vertical);
toolbar->setMovable( false );
toolbar->setToolButtonStyle(Qt::ToolButtonTextOnly);
QLabel *l = new QLabel(this);
l->setPixmap(QPixmap(":/images/spacer"));
toolbar->addWidget(l);
toolbar->addAction(overviewAction);
toolbar->addAction(sendCoinsAction);
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
toolbar->addAction(addressBookAction);
toolbar->addAction(masternodeManagerAction);
toolbar->setStyleSheet("#toolbar { border:1px;height:100%;padding-top:100px; background: transparent; text-align: center; color: black;min-width:200px;max-width:200px;} QToolBar QToolButton:hover {background-image: url(:images/toolbtnh); background-color: transparent;} QToolBar QToolButton:selected {background-color: transparent;} QToolBar QToolButton:checked {background-image: url(:images/toolbtns); background-color: transparent;} QToolBar QToolButton:pressed {background-color: transparent;} QToolBar QToolButton { margin: 2px; background-image:url(:images/toolbtn); font-family:'Bebas'; font-size:14px; min-width:160px;max-width:160px; min-height:40px;max-height:40px; color: white; text-align: center; }");
}
示例7: QLabel
QLayout * AboutDlg::initHPButtonLayout()
{
// Lay out the HP logo and OK button
QLabel * hpLogo = new QLabel();
hpLogo->setMaximumSize(141, 116);
hpLogo->setPixmap(QPixmap(":/images/hptran.png"));
hpLogo->setAlignment(Qt::AlignCenter);
QLayout * buttonLayout = initButtonLayout();
QVBoxLayout * hpButtonLayout = new QVBoxLayout();
hpButtonLayout->addWidget(hpLogo);
hpButtonLayout->addStretch(1);
hpButtonLayout->addLayout(buttonLayout);
hpButtonLayout->addStretch(1);
return hpButtonLayout;
}
示例8: changeCaseImage
void VirusGenius::changeCaseImage(int x, int y, QString Image)
{
QImage img;
QString pathOfImageToLoad;
if (Image == "black")
pathOfImageToLoad = imageBlackPath;
else if (Image == "white")
pathOfImageToLoad = imageWhitePath;
else
pathOfImageToLoad = imageEmptyPath;
img.load(pathOfImageToLoad);
QLabel* lab = (QLabel*) ui.gridLayout->itemAtPosition(x, y)->widget();
lab->setPixmap(QPixmap::fromImage(img));
lab->setFixedWidth(img.width());
lab->setFixedHeight(img.height());
}
示例9: addThumbnail
void uVision::addThumbnail(QImage smallpm)
{
static int i = 0;
static int j = 0;
//qWarning() << "thumbnail create successfully..." << j << i ;
//qWarning() << "Small PM:"<<smallpm << smallpm.size();
QLabel* label = new QLabel;
label->setPixmap(QPixmap::fromImage(smallpm));
QGridLayout* gl = qobject_cast<QGridLayout*>(previewwidget->layout());
gl->addWidget(label, j, i);
label->show();
qWarning() << "Label:" <<label << label->isVisible();
i++;
if( i > previewwidget->width() / smallpm.width())
{
i = 0;
j ++;
}
}
示例10: ShowCover
void AlbumCoverChoiceController::ShowCover(const Song& song) {
QDialog* dialog = new QDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
// Use Artist - Album as the window title
QString title_text(song.albumartist());
if (title_text.isEmpty()) title_text = song.artist();
if (!song.album().isEmpty()) title_text += " - " + song.album();
dialog->setWindowTitle(title_text);
QLabel* label = new QLabel(dialog);
label->setPixmap(AlbumCoverLoader::TryLoadPixmap(
song.art_automatic(), song.art_manual(), song.url().toLocalFile()));
dialog->resize(label->pixmap()->size());
dialog->show();
}
示例11: QHBoxLayout
AMWorkflowView3::AMWorkflowView3(AMActionRunner3 *actionRunner, QWidget *parent) :
QWidget(parent)
{
layoutSpacer_ = 0;
QHBoxLayout* hl = new QHBoxLayout();
hl->setContentsMargins(12,12,12,12);
hl->setSpacing(12);
QLabel* titleIcon = new QLabel();
titleIcon->setMaximumSize(36,36);
titleIcon->setPixmap(QPixmap(":/user-away.png"));
titleIcon->setScaledContents(true);
hl->addWidget(titleIcon);
QLabel* titleLabel = new QLabel(actionRunner->actionRunnerTitle());
titleLabel->setStyleSheet("font: " AM_FONT_XLARGE_ "pt \"Lucida Grande\";\ncolor: rgb(79, 79, 79);");
hl->addWidget(titleLabel);
hl->addStretch(1);
addActionButton_ = new QPushButton("Add Action...");
hl->addWidget(addActionButton_);
currentView_ = new AMActionRunnerCurrentView3(actionRunner);
queueView_ = new AMActionRunnerQueueView3(actionRunner);
historyView_ = new AMActionHistoryView3(actionRunner, actionRunner->loggingDatabase());
addActionDialog_ = 0;
QVBoxLayout* vl = new QVBoxLayout();
vl->setContentsMargins(0,0,0,0);
vl->setSpacing(0);
vl->addLayout(hl);
vl->addWidget(historyView_);
vl->addSpacing(12);
vl->addWidget(currentView_);
vl->addSpacing(12);
vl->addWidget(queueView_);
setLayout(vl);
connect(queueView_, SIGNAL(collapsed(bool)), this, SLOT(onViewCollapsed()));
connect(historyView_, SIGNAL(collapsed(bool)), this, SLOT(onViewCollapsed()));
connect(addActionButton_, SIGNAL(clicked()), this, SLOT(onAddActionButtonClicked()));
}
示例12: updateRenderImage
void QtkMainWindow::updateRenderImage(const int target,QImage *newImage)
{
QLabel *drawed = NULL;
if(target == 0)
drawed = _localLabel;
else if(target == 1)
drawed = _remoteLabel;
if(drawed != NULL && !newImage->isNull() && newImage->width() > 0 && newImage->height() > 0)
{
drawed->setFixedSize(newImage->width(),newImage->height());
drawed->setPixmap(QPixmap::fromImage(*newImage));
drawed->show();
}
if(target == 0)
local_renderer_->turnUpdated();
else if(target == 1)
remote_renderer_->turnUpdated();
}
示例13: singleLED_Dark
void Parameter_LED8x8_Form::initSetting()
{
//this->setWindowState(Qt::WindowActive);
this->installEventFilter(this);
this->setFocus();
this->setAttribute(Qt::WA_TranslucentBackground, true);
//恩原来是tool
this->setWindowFlags(Qt::FramelessWindowHint /*| Qt::Tool*/);
pushButton->setWindowFlags(Qt::FramelessWindowHint);
pushButton->setAttribute(Qt::WA_TranslucentBackground);
for (int i = 0 ; i < 8 ; i ++){
for (int j = 0 ; j < 8 ; j ++){
ledState_[i*8+j] = 0;
}
}
int widget_pos_x = (rect_.width() - widgetBg->width()) / 2; //根据屏幕分辨率 计算窗体位置
int widget_pos_y = (rect_.height() - widgetBg->height()) / 2;
int bgi_pos_x = bgimage->x();
int bgi_pos_y = bgimage->y();
QPixmap singleLED_Dark("resource/images/parameter_input/LED_Matrix/ParameterSetup_8x8LED_Single_Dark.png");
for (int i = 0 ; i < 8 ; i ++){
for (int j = 0 ; j < 8 ; j ++){
QLabel *p = new QLabel(this);
p->setObjectName(QString::number((i*8+j)));
p->move(widget_pos_x + bgi_pos_x + 5 + j*43,widget_pos_y + bgi_pos_y + 5 + i*43);
p->resize(32,32);
p->setPixmap(singleLED_Dark);
p->setAttribute(Qt::WA_TranslucentBackground);
LEDsList_.append(p);
ledState_[j*8+i] = 0;
}
}
}
示例14: QWidget
DemoWidget::DemoWidget(QWidget* _parent)
: QWidget(_parent)
{
QLightBoxWidget* lightBox = new QLightBoxWidget(this);
QLabel* text = new QLabel("Some information in <b>html</b> format<br/>"
"<ul><li>one</li><li>two</li><li>three</li></ul>");
QLabel* image = new QLabel;
image->setPixmap(QPixmap(":/image.jpg"));
QPushButton* showLB = new QPushButton(tr("Show"));
QGridLayout* mainLayout = new QGridLayout;
mainLayout->addWidget(text, 0, 0, Qt::AlignTop);
mainLayout->addWidget(image, 0, 1);
mainLayout->addWidget(showLB, 1, 1);
this->setLayout(mainLayout);
QLabel* lbTitle = new QLabel(tr("QLightBoxWidget"));
lbTitle->setStyleSheet("font-size: 28px; font-weight: bold; color: white");
QLabel* lbProgress = new QLabel;
QMovie* progressMovie = new QMovie(":/loader.gif");
lbProgress->setMovie(progressMovie);
progressMovie->start();
QLabel* lbDescription = new QLabel(tr("Example how to use QLightBoxWidget\n"
"in your QtWidgets applications..."));
lbDescription->setStyleSheet("color: white");
QPushButton* lbClose = new QPushButton(tr("Close"));
QGridLayout* lbLayout = new QGridLayout;
lbLayout->setRowStretch(0, 1);
lbLayout->setColumnStretch(0, 1);
lbLayout->addWidget(lbTitle, 1, 1);
lbLayout->addWidget(lbProgress, 1, 2, Qt::AlignRight);
lbLayout->setColumnStretch(3, 1);
lbLayout->addWidget(lbDescription, 2, 1, 1, 2);
lbLayout->addWidget(lbClose, 3, 2);
lbLayout->setRowStretch(4, 1);
connect(showLB, SIGNAL(clicked()), lightBox, SLOT(show()));
connect(lbClose, SIGNAL(clicked()), lightBox, SLOT(hide()));
lightBox->setLayout(lbLayout);
}
示例15: QWidget
//! @return The title Qucs with its icon
QWidget *AboutQUCS::title() const
{
QWidget *icon_and_title = new QWidget();
// icon
QLabel *icon = new QLabel();
icon->setPixmap(QPixmap(Qucs::bitmapDirectory() + "qucs.png"));
// label "Qucs"
QLabel *title = new QLabel("<span style=\"font-weight:0;font-size:16pt;\">Qucs v"
+ Qucs::version + "</span>");
title->setTextFormat(Qt::RichText);
// All in a grid
QGridLayout *grid_layout = new QGridLayout();
grid_layout->addWidget(icon, 0, 0);
grid_layout->addWidget(title, 0, 1);
grid_layout->setColumnStretch(0, 1);
grid_layout->setColumnStretch(1, 100);
icon_and_title->setLayout(grid_layout);
return icon_and_title;
}