当前位置: 首页>>代码示例>>C++>>正文


C++ QLabel::setPixmap方法代码示例

本文整理汇总了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++;
    }



}
开发者ID:WilliamAvila,项目名称:Proyecto2EstructurasDeDatos,代码行数:43,代码来源:windowuser.cpp

示例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;
}
开发者ID:NyFanomezana,项目名称:freemedforms,代码行数:43,代码来源:appaboutpage.cpp

示例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);
}
开发者ID:hpsaturn,项目名称:tupi,代码行数:19,代码来源:tupbrushstatus.cpp

示例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>&lt;[email protected]&gt;</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 );
}
开发者ID:BGCX262,项目名称:zsoft-svn-to-git,代码行数:43,代码来源:ZAboutDlg.cpp

示例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();
}
开发者ID:flaska,项目名称:DPEngine,代码行数:19,代码来源:test.cpp

示例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; }");
}
开发者ID:lin0sspice,项目名称:pentacoin,代码行数:19,代码来源:bitcoingui.cpp

示例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;
}
开发者ID:WeiqiJust,项目名称:CHER-Ob,代码行数:19,代码来源:aboutdlg.cpp

示例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());
}
开发者ID:Theov,项目名称:AI_GAMES,代码行数:19,代码来源:virusgenius.cpp

示例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 ++;
	}
}
开发者ID:githubcjl,项目名称:uVision_cjl,代码行数:19,代码来源:uvision.cpp

示例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();
}
开发者ID:RaoulChartreuse,项目名称:Clementine,代码行数:19,代码来源:albumcoverchoicecontroller.cpp

示例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()));
}
开发者ID:acquaman,项目名称:acquaman,代码行数:43,代码来源:AMWorkflowView3.cpp

示例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();

}
开发者ID:SibghatullahSheikh,项目名称:appRTCDesk,代码行数:19,代码来源:QtMainWindow.cpp

示例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;
        }
    }

}
开发者ID:CalciferLorain,项目名称:Mindplus-Desktop,代码行数:43,代码来源:Parameter_LED8x8_Form.cpp

示例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);
}
开发者ID:Iownnoname,项目名称:qt,代码行数:43,代码来源:demowidget.cpp

示例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;
}
开发者ID:damiansimanuk,项目名称:qucs-qt4,代码行数:20,代码来源:aboutqucs.cpp


注:本文中的QLabel::setPixmap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。