本文整理汇总了C++中QPushButton::setAutoFillBackground方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::setAutoFillBackground方法的具体用法?C++ QPushButton::setAutoFillBackground怎么用?C++ QPushButton::setAutoFillBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPushButton
的用法示例。
在下文中一共展示了QPushButton::setAutoFillBackground方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setDataPreviewLayout
/**
* Sets up the layout for the data preview area.
* @param dPreview The widget to set up the layout for.
*/
void CameraCalibrationEvaluation::setDataPreviewLayout(QWidget *dPreview) {
qDebug() << "CameraCalibrationEvaluation::setDataPreviewLayout("
<< "QScrollArea *picPreview)";
QVBoxLayout *dataPreviewLayout = new QVBoxLayout(dPreview);
tempPixmap = new QPixmap(QString::fromStdString(cameraCalibration->getImagePointsDistributionImagePath()));
*tempPixmap = tempPixmap->scaledToWidth(this->width() * 0.4);
QPushButton *tempButton = new QPushButton;
tempButton->setFlat(true);
tempButton->setAutoFillBackground(true);
tempButton->setIcon(QIcon(*tempPixmap));
tempButton->setIconSize(QSize(tempPixmap->width(),
tempPixmap->height()));
dataPreviewLayout->addWidget(tempButton);
connect(tempButton, SIGNAL(clicked()), picPreviewMapper, SLOT(map()));
picPreviewMapper->setMapping(tempButton,
QString::fromStdString(cameraCalibration->getImagePointsDistributionImagePath()));
results = new QPlainTextEdit;
results->setReadOnly(true);
results->setMinimumHeight(1);
results->setMinimumWidth(1);
QPalette palette;
palette.setColor(QPalette::Base,Qt::black);
palette.setColor(QPalette::Text,Qt::white);
results->setPalette(palette);
dataPreviewLayout->addWidget(results);
loadDataIntoResultPreview();
}
示例2: addScript
void LuaAVConsole :: addScript(const char *name, const char *filename, luaav_state *S) {
int idx = mScriptModel->getList().size();
mScriptModel->insertRow(idx, QModelIndex());
QModelIndex index = mScriptModel->index(idx, 0, QModelIndex());
mScriptModel->setData(index, QString(name), Qt::EditRole);
resizeTable(mSplitter->sizes().at(0), 0);
// table buttons for script actions
char bname[16];
QPushButton *closeButton = new QPushButton();
closeButton->setIcon(QIcon(QPixmap("/usr/share/luaav/x.png")));
closeButton->setFlat(true);
closeButton->setAutoFillBackground(true);
sprintf(bname, "close:%d", mScriptsLoaded);
closeButton->setObjectName(QString(bname));
connect(closeButton, SIGNAL(clicked()), this, SLOT(fileAction()));
mTableView->setIndexWidget(mScriptModel->index(idx, 1), closeButton);
QPushButton *reloadButton = new QPushButton();
reloadButton->setIcon(QIcon(QPixmap("/usr/share/luaav/reload.png")));
reloadButton->setFlat(true);
reloadButton->setAutoFillBackground(true);
sprintf(bname, "reload:%d", mScriptsLoaded);
reloadButton->setObjectName(QString(bname));
connect(reloadButton, SIGNAL(clicked()), this, SLOT(fileAction()));
mTableView->setIndexWidget(mScriptModel->index(idx, 2), reloadButton);
QPushButton *editButton = new QPushButton();
editButton->setIcon(QIcon(QPixmap("/usr/share/luaav/eye.png")));
editButton->setFlat(true);
editButton->setAutoFillBackground(true);
sprintf(bname, "edit:%d", mScriptsLoaded);
editButton->setObjectName(QString(bname));
connect(editButton, SIGNAL(clicked()), this, SLOT(fileAction()));
mTableView->setIndexWidget(mScriptModel->index(idx, 3), editButton);
mScripts.push_back(new ScriptData(mScriptsLoaded, name, filename, S));
mScriptsLoaded++;
}
示例3: loadImagesIntoPreview
/**
* Loads the given images from the system and places them as button into the
* image preview area.
* @param imageFiles Vector of string holding the path to the images to load.
*/
void CameraCalibrationEvaluation::loadImagesIntoPreview(
std::vector<std::string> imageFiles) {
qDebug() << "CameraCalibrationEvaluation::loadImagesIntoPreview("
<< "std::vector<std::string> imageFiles)";
picPreviewMapper = new QSignalMapper();
for (unsigned int i = 0; i < imageFiles.size(); i++) {
tempPixmap = new QPixmap(QString::fromStdString(imageFiles.at(i)));
*tempPixmap = tempPixmap->scaledToWidth(
this->width() * 0.45);
QPushButton *tempButton = new QPushButton;
tempButton->setFlat(true);
tempButton->setAutoFillBackground(true);
tempButton->setIcon(QIcon(*tempPixmap));
tempButton->setIconSize(QSize(tempPixmap->width(),
tempPixmap->height()));
imagePreviewLayout->addWidget(tempButton);
connect(tempButton, SIGNAL(clicked()), picPreviewMapper, SLOT(map()));
picPreviewMapper->setMapping(tempButton,
QString::fromStdString(imageFiles.at(i)));
}
}
示例4: QPushButton
// add a button
QPushButton *
QTACFunctions::addButton (QString text)
{
QFont fnt;
QPushButton *btn;
QString stylesheet;
stylesheet =
"background: transparent; border: 1px solid transparent;border-color: darkgray;";
btn = new QPushButton (text, this);
btn->setFixedSize (QSize (button_width, button_height));
fnt = btn->font ();
fnt.setPixelSize (16);
fnt.setBold (true);
btn->setFont (fnt);
btn->setStyleSheet (stylesheet);
btn->setAutoFillBackground (false);
btn->setFocusPolicy (Qt::NoFocus);
Button += btn;
return btn;
}
示例5: QListWidgetItem
void Home::addContact(UserInfo *added)
{
QListWidgetItem *item;
QFont font;
QPushButton *but;
QString name;
QPixmap *pixmap = NULL;
QPalette palette;
t_contact *ptr = new t_contact;
std::string tmp;
int state;
state = added->get_status();
if (state < 1 && state > 4)
state = 4;
item = new QListWidgetItem();
tmp = added->get_name() + " " + added->get_surname();
name = tmp.c_str();
item->setText(name);
item->setTextAlignment(21);
item->setBackgroundColor(QColor(255, 255, 255));
font.setPointSize(12);
font.setFamily("calibri");
item->setFont(font);
font.setPointSize(8);
ui->_listContact->addItem(item);
but = new QPushButton(added->get_nickname().c_str());
but->setFlat(true);
switch (state)
{
case 2:
pixmap = new QPixmap("./Images/BabelHD_0001s_0005s_0002_status.png");
break;
case 3:
pixmap = new QPixmap("./Images/BabelHD_0001s_0003s_0000_status.png");
break;
case 4:
pixmap = new QPixmap("./Images/BabelHD_0001s_0000s_0000_status.png");
break;
case 1:
pixmap = new QPixmap("./Images/BabelHD_0001s_0002s_0000_status.png");
break;
default:
break;
}
if (pixmap != NULL)
palette.setBrush(but->backgroundRole(), QBrush(*pixmap));
but->setFlat(true);
but->setAutoFillBackground(true);
but->setPalette(palette);
but->setFont(font);
but->setMinimumSize(250, 42);
but->setMaximumSize(250, 42);
std::stringstream ss;
ss << added->get_id();
ss >> tmp;
but->setObjectName(tmp.c_str());
but->setStyleSheet("text-align: middle");
connect(but, SIGNAL(clicked()), this, SLOT(contactClick()));
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget(but);
layout->alignment();
ptr->but = but;
ptr->item = item;
_bcontact[added->get_id()] = ptr;
QWidget *widget = new QWidget();
widget->setLayout(layout);
item->setSizeHint(widget->sizeHint());
ui->_listContact->setItemWidget(item, widget);
}
示例6: npq
//.........这里部分代码省略.........
// add a search box on far right, but with a little space too
SearchFilterBox *searchBox = new SearchFilterBox(this,context,false);
searchBox->setStyle(toolStyle);
searchBox->setFixedWidth(200);
head->addWidget(searchBox);
connect(searchBox, SIGNAL(searchResults(QStringList)), this, SLOT(setFilter(QStringList)));
connect(searchBox, SIGNAL(searchClear()), this, SLOT(clearFilter()));
#endif
Spacer *spacer = new Spacer(this);
spacer->setFixedWidth(5);
head->addWidget(spacer);
#endif
/*----------------------------------------------------------------------
* ScopeBar
*--------------------------------------------------------------------*/
scopebar = new GcScopeBar(context);
connect(scopebar, SIGNAL(selectDiary()), this, SLOT(selectDiary()));
connect(scopebar, SIGNAL(selectHome()), this, SLOT(selectHome()));
connect(scopebar, SIGNAL(selectAnal()), this, SLOT(selectAnalysis()));
connect(scopebar, SIGNAL(selectTrain()), this, SLOT(selectTrain()));
// Add chart is on the scope bar
chartMenu = new QMenu(this);
QCleanlooksStyle *styler = new QCleanlooksStyle();
QPushButton *newchart = new QPushButton("+", this);
scopebar->addWidget(newchart);
newchart->setStyle(styler);
newchart->setFixedHeight(20);
newchart->setFixedWidth(24);
newchart->setFlat(true);
newchart->setFocusPolicy(Qt::NoFocus);
newchart->setToolTip(tr("Add Chart"));
newchart->setAutoFillBackground(false);
newchart->setAutoDefault(false);
newchart->setMenu(chartMenu);
connect(chartMenu, SIGNAL(aboutToShow()), this, SLOT(setChartMenu()));
connect(chartMenu, SIGNAL(triggered(QAction*)), this, SLOT(addChart(QAction*)));
/*----------------------------------------------------------------------
* Central Widget
*--------------------------------------------------------------------*/
tab = new Tab(context);
/*----------------------------------------------------------------------
* Central Widget
*--------------------------------------------------------------------*/
QWidget *central = new QWidget(this);
setContentsMargins(0,0,0,0);
central->setContentsMargins(0,0,0,0);
QVBoxLayout *mainLayout = new QVBoxLayout(central);
mainLayout->setSpacing(0);
mainLayout->setContentsMargins(0,0,0,0);
#ifndef Q_OS_MAC // nonmac toolbar on main view -- its not
// unified with the title bar.
mainLayout->addWidget(head);
#endif
mainLayout->addWidget(scopebar);
mainLayout->addWidget(tab);
setCentralWidget(central);
/*----------------------------------------------------------------------
* Application Menus
*--------------------------------------------------------------------*/