本文整理汇总了C++中QDialog::setAutoFillBackground方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::setAutoFillBackground方法的具体用法?C++ QDialog::setAutoFillBackground怎么用?C++ QDialog::setAutoFillBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::setAutoFillBackground方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: main
int main(int argc,char *argv[])
{
if (argc < 1)
return 1;
const QString skinFile = QString::fromUtf8(argv[1]);
QApplication app(argc,argv);
QMainWindow mw;
DeviceSkinParameters params;
QString errorMessage;
if (!params.read(skinFile, DeviceSkinParameters::ReadAll, &errorMessage)) {
qWarning() << errorMessage;
return 1;
}
DeviceSkin ds(params, &mw);
// View Dialog
QDialog *dialog = new QDialog();
QHBoxLayout *dialogLayout = new QHBoxLayout();
dialog->setLayout(dialogLayout);
QDialogButtonBox *dialogButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
QObject::connect(dialogButtonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
QObject::connect(dialogButtonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
dialogLayout->addWidget(dialogButtonBox);
dialog->setFixedSize(params.screenSize());
dialog->setParent(&ds, Qt::SubWindow);
dialog->setAutoFillBackground(true);
ds.setView(dialog);
QObject::connect(&ds, SIGNAL(popupMenu()), &mw, SLOT(close()));
QObject::connect(&ds, SIGNAL(skinKeyPressEvent(int,QString,bool)), &mw, SLOT(close()));
mw.show();
return app.exec();
}
示例3: zeitanzeige
void gesamtbild::zeitanzeige(/*int dora, int hin, int may*/)
{
qWarning() << "Zeit";
QDialog *zeitw = new QDialog(this);
QVBoxLayout layout(zeitw);
QLabel *anzeige = new QLabel(tr("Time: Day %1,").arg(GAMEDATA->gametime().day()).append(QString("%1 hours").arg(GAMEDATA->gametime().hour())), zeitw);
// anzeige->setText(anzeige->text().append(QString(", %2 Uhr %3").arg( gameview->stunde, gameview->minute)));gameview->stunde
// qWarning() << anzeige->text().append(QString(", %2 Uhr %3").arg( gameview->stunde, gameview->minute));
QPushButton *ok = new QPushButton("Ok",zeitw);
ok->move(50, 50);
layout.addWidget(anzeige);
layout.addWidget(ok);
// zeitw->setGeometry(width()/2,height()/2,200,100);
zeitw->setLayout(&layout);
zeitw->setAutoFillBackground(true);
zeitw->move(gameview->width()/2,gameview->height()/2);
zeitw->raise();
zeitw->show();
connect(ok, SIGNAL(clicked()), gameview, SLOT(endePause()));
connect(ok, SIGNAL(clicked()), zeitw, SLOT(close()));
connect(ok, SIGNAL(clicked()), zeitw, SLOT(deleteLater()));
}