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


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

本文整理汇总了C++中QLabel::setStyleSheet方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setStyleSheet方法的具体用法?C++ QLabel::setStyleSheet怎么用?C++ QLabel::setStyleSheet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QLabel的用法示例。


在下文中一共展示了QLabel::setStyleSheet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: settings

ForDelete::ForDelete(QString id, QString tabNameAud, QWidget *parent) :
    QDialog(parent)
{
    tabNameAuditee = tabNameAud;
    indexTemp = id;
    QSettings settings("AO_Batrakov_Inc.", "EmployeeClient");
    tabNameAuditee = settings.value("Table").toString();
    indexTemp = settings.value("Index").toString();

    QVBoxLayout *mainLayout = new QVBoxLayout;
    QSqlQuery query;
    query.exec("select tbl_name from sqlite_master where type = 'table'");//SQLite

    QLabel *newLabel = new QLabel;
    labelLabel = new QLabel;
    QString toOut;
    QPushButton *okButton = new QPushButton("Ok");
    connect(okButton,SIGNAL(clicked()),this,SLOT(close()));

    while(query.next()){
        if(tabNameAuditee != query.value(0).toString()){//имя таблицы
            QSqlQuery queryTable;

            QString table = query.value(0).toString();
            QString tableid = table;
            tableid += "id";
            QString tableName = table;
            tableName += "name";
            QString textQuery = "SELECT ";
            textQuery += tableid;
            textQuery += ", ";
            textQuery += tableName;
            textQuery += " FROM ";
            textQuery += table;
            textQuery += " WHERE ";
            textQuery += tabNameAuditee;
            textQuery += "id = '";
            textQuery += indexTemp;
            textQuery += "';";
            queryTable.exec(textQuery);
            queryTable.next();
            if(queryTable.isActive()){
                toOut = tr("Table ");
                toOut += table;
                toOut += tr(" contains - ");
                toOut += QString::number(queryTable.size());
                toOut += tr(" records.");
                newLabel->setStyleSheet("font: bold; color: red;");
            }else{
                toOut = "No related Tables! Deleting.";
                newLabel->setStyleSheet("font: bold; color: darkblue;");
            }
        }
    }
    newLabel->setText(toOut);
    mainLayout->addWidget(newLabel);
    mainLayout->addWidget(okButton);
    setLayout(mainLayout);
    setWindowTitle(tr("Conditions for removal..."));
}
开发者ID:AndrewBatrakov,项目名称:EmployeeClient,代码行数:60,代码来源:fordelete.cpp

示例2: UpdateDps

void MainWindow::UpdateDps(int dps)
{
    QLabel* Label1;
    QProgressBar* Bar1;
    int i,j,k;


    QLabel* dpsLabel = ui->labelDpsValue;
    dpsLabel->setText(QString::number(dps));
    if (dps > DMGMETER_HIGH_DPS_LIMIT)
    {
        dpsLabel->setStyleSheet(DmgMeter::s_UltraStyle);
    }
    else if (dps > DMGMETER_NORMAL_DPS_LIMIT)
    {
        dpsLabel->setStyleSheet(DmgMeter::s_HighStyle);
    }
    else if (dps > DMGMETER_LOW_DPS_LIMIT)
    {
        dpsLabel->setStyleSheet(DmgMeter::s_NormalStyle);
    }
    else
    {
        dpsLabel->setStyleSheet(DmgMeter::s_LowStyle);
    }

}
开发者ID:DomGrieco,项目名称:GW2DPS---Group-Damage-Meter,代码行数:27,代码来源:mainwindow.cpp

示例3: button_ImageNText

YGButton* Utility::button_ImageNText(const QSize &size, const QPoint &pos, const QString &bgImagePath,
                                     const QString &text, const QString &textColor, int fontPixelSize, bool fontBold,
                                     const QString &objName, QWidget *parent)
{
    YGButton *btn= new YGButton(YGButton::ButtonType_ImageBtn, parent);
    btn->addLanguageRes(QLocale::Chinese, bgImagePath);
    btn->addLanguageRes(QLocale::English, bgImagePath);
    if(!objName.isEmpty())
    {
        btn->setObjectName(objName);
    }
    btn->resize(size);
    btn->move(pos);

    QLabel *lbl = new QLabel(btn);
    lbl->resize(btn->size());
    if(fontBold)
    {
        lbl->setStyleSheet(QString("QLabel{background:transparent;  color:%1; font-size: %2px; font-weight:bold;}").arg(textColor).arg(fontPixelSize));
    }
    else
    {
        lbl->setStyleSheet(QString("QLabel{background:transparent;  color:%1; font-size: %2px;}").arg(textColor).arg(fontPixelSize));
    }
    lbl->setText(text);
    lbl->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);

    return btn;
}
开发者ID:JandunCN,项目名称:AllInGithub,代码行数:29,代码来源:utility.cpp

示例4: QWidget

LogViewer::LogViewer(QWidget* parent) :
    QWidget(parent)
{
    QVBoxLayout* layout = new QVBoxLayout;
    QLabel* outputLabel = new QLabel;
    outputLabel->setText("Standard Output:");
    outputLabel->setStyleSheet("font-size: 13pt;");

    layout->addWidget(outputLabel);

    _outputView = new QTextEdit;
    _outputView->setUndoRedoEnabled(false);
    _outputView->setReadOnly(true);

    layout->addWidget(_outputView);

    QLabel* errorLabel = new QLabel;
    errorLabel->setText("Standard Error:");
    errorLabel->setStyleSheet("font-size: 13pt;");

    layout->addWidget(errorLabel);

    _errorView = new QTextEdit;
    _errorView->setUndoRedoEnabled(false);
    _errorView->setReadOnly(true);

    layout->addWidget(_errorView);
    setLayout(layout);
}
开发者ID:binaryking,项目名称:StackManagerQt,代码行数:29,代码来源:LogViewer.cpp

示例5: SubSection

  SubSection(const QString & title, const QString & description, QLabel * imageLabel) : QWidget() 
  {
    QHBoxLayout * mainHLayout = new QHBoxLayout();
    setLayout(mainHLayout);

    mainHLayout->addWidget(imageLabel);

    QVBoxLayout * mainVLayout = new QVBoxLayout();
    mainHLayout->addLayout(mainVLayout);
    QLabel * titleLabel = new QLabel(title);
    titleLabel->setStyleSheet("QLabel { font-size: 14px; font: bold; color: #242D31; }");
    titleLabel->setWordWrap(true);
    mainVLayout->addWidget(titleLabel);

    QHBoxLayout * descriptionHLayout = new QHBoxLayout();
    mainVLayout->addLayout(descriptionHLayout);
    descriptionHLayout->addSpacing(35);

    QLabel * descriptionLabel = new QLabel(description);
    descriptionLabel->setFixedWidth(700);
    descriptionLabel->setStyleSheet("QLabel { font-size: 14px; color: black; }");
    descriptionLabel->setWordWrap(true);
    descriptionHLayout->addWidget(descriptionLabel);

    mainHLayout->setAlignment(Qt::AlignLeft);
  }
开发者ID:Zicao,项目名称:OpenStudio,代码行数:26,代码来源:StartupView.cpp

示例6: cleanHighlights

void Widget::cleanHighlights()
{
    for (int i = 0; i < 9; i++) {
        for (int j = 0; j < 9; j++) {
            QLabel* cellOrigin = getOriginPointToCellMap()[QPair<int,int>(i,j)];
            QLabel* cellResult = getResultPointToCellMap()[QPair<int,int>(i,j)];;
            cellResult->setText(" ");
            cellResult->setStyleSheet(" ");
            cellOrigin->setStyleSheet(" ");
        }
    }
}
开发者ID:2easy4wizzi,项目名称:soduku,代码行数:12,代码来源:widget.cpp

示例7: pixmap

AboutDialog::AboutDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AboutDialog)
{
    this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
    setGeometry(0, 0, SC_ABOUT_WIDTH, SC_ABOUT_HEIGHT);
    QPixmap pixmap(SC_ABOUT_IMAGE);
    setMask(pixmap.mask());

    QPalette palette;
    palette.setBrush(QPalette::Background, pixmap);
    setPalette(palette);

    QString qstrVersion = "<span style=\"font-family:" + QString(SC_BOLD_FONT_NAME) + "\">" +
                          tr("stealth") +
                          "<span style=\"color:" + QString(SC_MAIN_COLOR_BLUE) +
                          ";\">" + tr("client") + "</span> " +
                          "<span style=\"color:" + QString(SC_MAIN_COLOR_GREY) +
                          ";\"> V " + QString::fromStdString(FormatVersionNumbers()) +
                          "</span></span>";


    QLabel* lblVersion = new QLabel(this);
    QFont fntVersion = lblVersion->font();
    fntVersion.setPixelSize(14);
    lblVersion->setFont(fntVersion);
    lblVersion->setAlignment(Qt::AlignCenter);
    lblVersion->setGeometry(0, 0, 200, 30);
    lblVersion->move(this->rect().center() - lblVersion->rect().center());
    lblVersion->setText(qstrVersion);
    lblVersion->setStyleSheet("QLabel {color: white;}");

    QString qstrCopy = QString::fromUtf8(
      "\u00A9 2014 AlphabetCoinFund Developers\n"
      "This is experimental software.\n"
      "If you don't treat it as such,\n"
      "you're likely to put an eye out.");

    QLabel* lblCopy = new QLabel(this);
    QFont fntCopy = lblCopy->font();
    fntCopy.setPixelSize(12);
    lblCopy->setFont(fntCopy);
    lblCopy->setAlignment(Qt::AlignCenter);
    lblCopy->setGeometry(0, 0, 220, 70);
    QPoint pt = this->rect().center() - lblCopy->rect().center();
    lblCopy->move(pt.x(), pt.y() + 60);
    lblCopy->setText(qstrCopy);
    // lblCopy->setStyleSheet("QLabel {color: white; background-color: blue;}");
    lblCopy->setStyleSheet("QLabel {color: white;}");


    move(QApplication::desktop()->screen()->rect().center() - this->rect().center());
}
开发者ID:alphabetcoinfund,项目名称:alphabetcoinfund,代码行数:53,代码来源:aboutdialog.cpp

示例8: addScore

//Adds a score to interface
void ScoreWindow::addScore(ScoreObject *s){
    if(!isEndgame)
    {
        makeEndGame();
    }
    QLabel *label = new QLabel(ui->frScore);
    label->setGeometry(4, nextY, 20, 20);
    if(s->team() == 2)
    {
        label->setStyleSheet("background:#44707b");
    }
    else if (s->team() == 1)
    {
        label->setStyleSheet("background:#a23a1d");
    }
    label->show();

    label = new QLabel(ui->frScore);
    label->setGeometry(32, nextY, 122, 20);
    label->setText(s->username());
    label->setStyleSheet("color:#333333");
    label->show();

    label = new QLabel(ui->frScore);
    label->setGeometry(162, nextY, 66, 20);
    label->setAlignment(Qt::AlignRight);
    label->setText(QString::number(s->deaths()));
    label->setStyleSheet("color:#333333");
    label->show();

    label = new QLabel(ui->frScore);
    label->setGeometry(236, nextY, 66, 20);
    label->setAlignment(Qt::AlignRight);
    label->setText(QString::number(s->tKills()));
    label->setStyleSheet("color:#333333");
    label->show();

    label = new QLabel(ui->frScore);
    label->setGeometry(310, nextY, 66, 20);
    label->setAlignment(Qt::AlignRight);
    label->setText(QString::number(s->mKills()));
    label->setStyleSheet("color:#333333");
    label->show();

    label = new QLabel(ui->frScore);
    label->setGeometry(384, nextY, 66, 20);
    label->setAlignment(Qt::AlignRight);
    label->setText(QString::number(s->pKills()));
    label->setStyleSheet("color:#333333");
    label->show();

    label = new QLabel(ui->frScore);
    label->setGeometry(458, nextY, 66, 20);
    label->setAlignment(Qt::AlignRight);
    label->setText(QString::number(s->score()));
    label->setStyleSheet("color:#333333");
    label->show();
    nextY += 26;
}
开发者ID:JSamp701,项目名称:cps111-j4-spring2013,代码行数:60,代码来源:scorewindow.cpp

示例9: showDetailsForItem

void StartupView::showDetailsForItem( const QModelIndex & index )
{
  QLayout * layout = m_projectDetailView->layout();

  for( int i = 0; i < layout->count(); i++ )
  {
    delete layout->itemAt(i)->widget();
    layout->removeItem(layout->itemAt(i));
  }

  QString name = m_templateListModel->data(index,Qt::ToolTipRole).toString();

  QString description = m_templateListModel->data(index,Qt::WhatsThisRole).toString();

  if( ! name.isEmpty() )
  {
    QLabel * nameLabel = new QLabel(name);

    nameLabel->setStyleSheet("QLabel { font: bold }");

    layout->addWidget(nameLabel);
  }

  if( ! description.isEmpty() )
  {
    QTextEdit * descriptionLabel = new QTextEdit(description);
    
    descriptionLabel->setStyleSheet("QTextEdit { border: none; }");
    
    descriptionLabel->setReadOnly(true);

    layout->addWidget(descriptionLabel);
  }

}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:35,代码来源:StartupView.cpp

示例10: QFrame

QuickHelp::QuickHelp(QWidget* widget, QPoint pos, QString text)
	: QFrame(0, Qt::ToolTip),
	  widget_(widget),
	  window_(widget->window())
{
	setAttribute(Qt::WA_DeleteOnClose);
	
	widget_->installEventFilter(this);
	window_->installEventFilter(this);
	
	QLabel* label = new QLabel;
	label->setStyleSheet(
		QString("QLabel { background-color: %1; }").arg(label->palette().toolTipBase().color().name())
	);
	label->setTextFormat(Qt::RichText);
	// label->setOpenExternalLinks(true);
	label->setText(text);
	connect(label, SIGNAL(linkActivated(const QString&)), this, SLOT(openLink(const QString&)));
	
	#ifdef QT_MAC_USE_COCOA
	setFrameStyle(QFrame::NoFrame);
	#else
	setFrameStyle(QFrame::Plain|QFrame::StyledPanel);
	#endif
	
	QVBoxLayout* col = new QVBoxLayout;
	col->setSpacing(0);
	col->setMargin(0);
	col->addWidget(label);
	setLayout(col);
	
	move(widget->mapToGlobal(pos));
	show();
}
开发者ID:corelon,项目名称:paco,代码行数:34,代码来源:QuickHelp.cpp

示例11: display

void CGraphicBuildingTile::display(QList<QString> _toDisplay)
{
    QDialog* infoDialog = new QDialog;//(dynamic_cast<QWidget*>(this->parent()));
    QVBoxLayout* newLayout = new QVBoxLayout();
    int q=0;
    QScrollArea* scrolArea = new QScrollArea(dynamic_cast<QWidget*>(this->parent()));
    for(int i=0;i<_toDisplay.count();i++)
    {   QLabel* newLabel = new QLabel(_toDisplay.at(i));
        newLabel->setFixedWidth(280);
        newLabel->setMinimumHeight(22);
        newLabel->setStyleSheet("border: 1px solid black");
        newLayout->addWidget(newLabel);
        q++;
    }
    QPalette pal;
    pal.setColor(QPalette::Background,QColor(230,200,167));
    infoDialog->setFixedWidth(330);
    infoDialog->setMinimumHeight(30+22*q);
    infoDialog->setLayout(newLayout);
    infoDialog->setAutoFillBackground(true);
    infoDialog->setPalette(pal);
    infoDialog->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::Dialog);
    scrolArea->setWidget(infoDialog);
    scrolArea->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::Dialog);
    scrolArea->setMaximumHeight(infoDialog->size().height()+2);
    scrolArea->setWindowTitle(QString("Info about"));
    scrolArea->show();
}
开发者ID:KulerOvZuo,项目名称:SimCity,代码行数:28,代码来源:cgraphicbuildingtile.cpp

示例12: accessories

void accessories(QWidget *baseWidget)
{
    QLabel *player2 = new QLabel(baseWidget);
    QLabel *name2 = new QLabel("Player 2", baseWidget);
    QLabel *time2 = new QLabel("00:00:00", baseWidget);

    QLabel *player1 = new QLabel(baseWidget);
    QLabel *name1 = new QLabel("Player 1", baseWidget);
    QLabel *time1 = new QLabel("00:00:00", baseWidget);

    QLabel *moves = new QLabel(baseWidget);

    name1->setGeometry(125,610,80,20);
    time1->setGeometry(120,635,80,20);
    player1->setGeometry(100,500,100,100);
    player1->setPixmap(QPixmap(":/Images/profile.png"));

    name2->setGeometry(125,210,80,20);
    time2->setGeometry(120,235,80,20);
    player2->setGeometry(100,100,100,100);
    player2->setPixmap(QPixmap(":/Images/profile.png"));

    moves->setGeometry(1000,105,250,550);
    moves->setStyleSheet("QLabel {background-color: white;}");

}
开发者ID:Hariswaroop,项目名称:CHESS-in-Qt,代码行数:26,代码来源:main.cpp

示例13: createAnalogSignalBox

/*!
   Create a signal box widget for the \a list of analog signals.
*/
QWidget* UiSelectSignalDialog::createAnalogSignalBox(QList<int> &list)
{

    // Deallocation:
    //   Ownership is taken over by call to w->setlayout
    QGridLayout* l = new QGridLayout();
    l->setSizeConstraint(QLayout::SetFixedSize);

    for (int i = 0; i < list.size(); i++) {
        int id = list.at(i);

        // Deallocation: "Qt Object trees" (See UiMainWindow)
        QLabel* cl = new QLabel("    ");
        QString color = Configuration::instance().analogInCableColor(id).name();
        cl->setStyleSheet(QString("QLabel { background-color : %1; }").arg(color));
        l->addWidget(cl, 0, i);

        // Deallocation: "Qt Object trees" (See UiMainWindow)
        l->addWidget(new QLabel(QString("A%1").arg(id), this), 1, i);
        // Deallocation: "Qt Object trees" (See UiMainWindow)
        QCheckBox* cb = new QCheckBox(this);
        l->addWidget(cb, 2, i);
        mAnalogSignalsMap.insert(id, cb);
    }

    // Deallocation: "Qt Object trees" (See UiMainWindow)
    QWidget* w = new QWidget(this);
    w->setLayout(l);

    return w;

}
开发者ID:JayBesGit,项目名称:labtool,代码行数:35,代码来源:uiselectsignaldialog.cpp

示例14: QWidget

RenderingColorWidget::RenderingColorWidget(QWidget * parent )
  : QWidget(parent)
{
  this->setObjectName("GrayWidget");

  QHBoxLayout* hLayout = new QHBoxLayout();
  hLayout->setContentsMargins(0,0,0,0);
  hLayout->setSpacing(10);
  this->setLayout(hLayout);

  QLabel* renderingColorLabel = new QLabel();
  renderingColorLabel->setText("Rendering Color: ");
  renderingColorLabel->setStyleSheet("QLabel { font: bold; }");
  hLayout->addWidget(renderingColorLabel);

  m_renderColorWidget = new QWidget();
  m_renderColorWidget->setFixedHeight(30);
  m_renderColorWidget->setFixedWidth(30);
  hLayout->addWidget(m_renderColorWidget);

  m_renderColorButton = new QPushButton();
  m_renderColorButton->setFlat(true); 
  m_renderColorButton->setText("Select Color");
  m_renderColorButton->setObjectName("StandardGrayButton");
  hLayout->addWidget(m_renderColorButton);
  hLayout->addStretch();

  bool isConnected = connect(m_renderColorButton, SIGNAL(clicked()), this, SLOT(renderColorButtonClicked()));
  OS_ASSERT(isConnected);
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:30,代码来源:RenderingColorWidget.cpp

示例15: QWidget

LivePanel::LivePanel(QWidget *parent) :
        QWidget(parent)
{
    QVBoxLayout *vboxLayout = new QVBoxLayout(this);
    vboxLayout->setSpacing(0);
    vboxLayout->setMargin(0);

    splitter = new QSplitter(this);
    splitter->setOrientation(Qt::Vertical);
    splitter->setOpaqueResize(false);
    vboxLayout->addWidget(splitter);

    QListView *listView = new QListView(splitter);
    //listView1->setSizePolicy(* new QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Maximum));
    //listView1->setGeometry(0,0,400,300);
    QFrame *frame = new QFrame(splitter);
    frame->setStyleSheet("background-color:white");
    //QMessageBox::about(this,QString::number(frame1->width()),"");
    //frame1->resize(frame1->width(),frame1->width()*3/4);
    frame->resize(256,192);
    //frame1->setFrameStyle(QFrame::Raised);
    QLabel *label = new QLabel(frame);
    label->setGeometry(10,10,400,300);
    label->setFrameStyle(QFrame::Box);
    label->setStyleSheet("background-color:green");
    label->setText("<html><head><body><center><h1>上山打老虎 1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0<br><h1></center></body></html>");

}
开发者ID:anderson916,项目名称:FreeWorship,代码行数:28,代码来源:LivePanel.cpp


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