本文整理汇总了C++中QPushButton::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::setAttribute方法的具体用法?C++ QPushButton::setAttribute怎么用?C++ QPushButton::setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPushButton
的用法示例。
在下文中一共展示了QPushButton::setAttribute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: timerOntimesignal
void MainWindow::timerOntimesignal()
{
subtitle* newsub = mysubs.front();
if((player->position() >= newsub->timerange.timeBegin) && (newsub->played == false))
{
cout << "creating subtitle" << endl;
for(int i = 0; i < (int) newsub->firstline.size(); ++i)
{
QHBoxLayout* newline = new QHBoxLayout;
for(int j = 0; j < (int) newsub->firstline[i].size(); ++j)
{
QPushButton* subtitleWord = new QPushButton;
subtitleWord->setFlat(true);
subtitleWord->setText(newsub->firstline[i][j]);
subtitleWord->setAttribute(Qt::WA_TranslucentBackground);
subtitleWord->setFont(QFont( "Arial", 20, QFont::Bold));
subtitleWord->setStyleSheet("color: rgb(220, 231, 97); padding: 1px;");
connect(subtitleWord, SIGNAL(clicked(bool)), this, SLOT(subtitleButtonClicked()));
newline->addWidget(subtitleWord);
}
subtitleLayout->addLayout(newline);
newline->setAlignment(Qt::AlignCenter);
}
newsub->played = true;
}
示例2: insertPage
void LiveGameSidebar::insertPage(int index, const QString &title, SidebarPage *sidebarPage)
{
QPushButton *button = new QPushButton(title, this);
button->setCheckable(true);
button->setAttribute(Qt::WA_MacShowFocusRect, false);
button->setFocusPolicy(Qt::NoFocus);
int id = m_stackedLayout->addWidget(sidebarPage);
m_buttonGroup->addButton(button, id);
m_layoutPageButtons->insertWidget(index, button);
m_sidebarPages.insert(index, sidebarPage);
button->setChecked(true);
QFile stylesheet2(":/pushbutton/iphotodarktab/stylesheet");
stylesheet2.open(QFile::ReadOnly);
QString style = stylesheet2.readAll();
if(index == m_stackedLayout->count() -1) {
QLayoutItem *item = m_layoutPageButtons->itemAt(m_stackedLayout->count() - 2);
if(item) {
QWidget *rightmostButton = item->widget();
if(rightmostButton) {
rightmostButton->setStyleSheet(style);
}
}
style += QLatin1String("QPushButton {margin-right: -1px; }");
}
button->setStyleSheet(style);
stylesheet2.close();
setCurrentPage(id);
}
示例3: displayNewUpdate
void CustomMessageBox::displayNewUpdate()
{
setFixedSize(434, 179);
_label->setText("Une version plus récente de Multifacile est disponible, veux-tu la télécharger ?");
_label->setWordWrap(true);
_label->move(45, 50);
_menu->move(376, 0);
_okBouton->setText(tr("Oui"));
_okBouton->move(346, 135);
QPushButton *No = new QPushButton(tr("Non"), this);
No->setAttribute(Qt::WA_TranslucentBackground);
No->move(386, 140);
No->setObjectName("NoButton");
No->setStyleSheet("QPushButton#NoButton{background-color: rgba(255, 255, 255, 0);color: rgb(144,191,79); background-image: url(none);}");
disconnect(_okBouton, SIGNAL(clicked()), this, SLOT(close()));
connect(_okBouton, SIGNAL(clicked()), this, SLOT(accept()));
connect(No, SIGNAL(clicked()), this, SLOT(reject()));
}
示例4: fontInfo
RenderThemeQt::RenderThemeQt()
: RenderTheme()
{
QPushButton button;
button.setAttribute(Qt::WA_MacSmallSize);
QFont defaultButtonFont = QApplication::font(&button);
QFontInfo fontInfo(defaultButtonFont);
m_buttonFontFamily = defaultButtonFont.family();
m_buttonFontPixelSize = fontInfo.pixelSize();
m_fallbackStyle = 0;
}
示例5: fontInfo
RenderThemeQt::RenderThemeQt(Page* page)
: RenderTheme()
, m_page(page)
{
QPushButton button;
button.setAttribute(Qt::WA_MacSmallSize);
QFont defaultButtonFont = QApplication::font(&button);
QFontInfo fontInfo(defaultButtonFont);
m_buttonFontFamily = defaultButtonFont.family();
#ifdef Q_WS_MAC
m_buttonFontPixelSize = fontInfo.pixelSize();
#endif
m_fallbackStyle = QStyleFactory::create(QLatin1String("windows"));
}
示例6: iconOn
QPushButton *ChatWidget::createButton(const QString &name){
QPushButton *button = new QPushButton;
button->setEnabled(true);
QPixmap iconOn(QString("image/system/chatface/%1On.png").arg(name));
QPixmap iconOff(QString("image/system/chatface/%1.png").arg(name));
QIcon icon;
icon.addPixmap(iconOff,QIcon::Normal,QIcon::Off);
icon.addPixmap(iconOn,QIcon::Active,QIcon::Off);
button->setIcon(icon);
button->setIconSize(iconOn.size());
button->setFixedSize(iconOn.size());
button->setObjectName(name);
button->setAttribute(Qt::WA_TranslucentBackground);
return button;
}
示例7: initUI
void DBaseDialog::initUI(const QString &icon,
const QString &message,
const QString &tipMessage,
const QStringList &buttonKeys,
const QStringList &buttonTexts){
m_icon = icon;
m_message = message;
m_tipMessage = tipMessage;
m_buttonKeys = buttonKeys;
m_buttonTexts = buttonTexts;
QFrame* contentFrame = new QFrame;
contentFrame->setObjectName("ContentFrame");
m_iconLabel = new QLabel;
m_iconLabel->setFixedSize(48, 48);
setIcon(m_icon);
m_messageLabel = new QLabel;
m_messageLabel->setObjectName("MessageLabel");
setMessage(m_message);
m_tipMessageLabel = new QLabel;
m_tipMessageLabel->setObjectName("TipMessageLabel");
setTipMessage(m_tipMessage);
m_buttonGroup = new QButtonGroup;
QHBoxLayout* buttonLayout = new QHBoxLayout;
foreach (QString label, m_buttonKeys) {
int index = m_buttonKeys.indexOf(label);
QPushButton* button = new QPushButton(label);
button->setObjectName("ActionButton");
button->setAttribute(Qt::WA_NoMousePropagation);
button->setFixedHeight(28);
m_buttonGroup->addButton(button, index);
buttonLayout->addWidget(button);
if (index < m_buttonKeys.length() - 1){
QLabel* label = new QLabel;
label->setObjectName("VLine");
label->setFixedWidth(1);
buttonLayout->addWidget(label);
}
}
示例8: icon_pixmap
QPushButton *Dashboard::createButton(const QString &name){
QPushButton *button = new QPushButton;
button->setEnabled(false);
QPixmap icon_pixmap(QString("image/system/button/%1.png").arg(name));
QPixmap icon_pixmap_disabled(QString("image/system/button/%1-disabled.png").arg(name));
QIcon icon(icon_pixmap);
icon.addPixmap(icon_pixmap_disabled, QIcon::Disabled);
//button->setIcon(icon);
//button->setIconSize(icon_pixmap.size());
button->setFixedSize(icon_pixmap.size());
button->setObjectName(name);
button->setProperty("game_control",true);
button->setAttribute(Qt::WA_TranslucentBackground);
return button;
}
示例9: fontInfo
RenderThemeQt::RenderThemeQt(Page* page)
: RenderTheme()
, m_page(page)
, m_lineEdit(0)
{
QPushButton button;
button.setAttribute(Qt::WA_MacSmallSize);
QFont defaultButtonFont = QApplication::font(&button);
QFontInfo fontInfo(defaultButtonFont);
m_buttonFontFamily = defaultButtonFont.family();
#ifdef Q_WS_MAC
m_buttonFontPixelSize = fontInfo.pixelSize();
#endif
#if USE(QT_MOBILE_THEME)
m_fallbackStyle = new QtMobileWebStyle;
#else
m_fallbackStyle = QStyleFactory::create(QLatin1String("windows"));
#endif
}
示例10: QGraphicsView
//.........这里部分代码省略.........
//setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
setOptimizationFlags(QGraphicsView::DontSavePainterState);
setFrameStyle(QFrame::NoFrame);
#ifdef Q_OS_ANDROID
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#endif
QWidget *viewport = new QWidget();
QVBoxLayout *vbox = new QVBoxLayout(viewport);
QHBoxLayout *hbox;
hbox = new QHBoxLayout();
{
hbox->setSpacing(0);
hbox->addStretch(1);
m_hudLabel = new QLabel();
hbox->addWidget(m_hudLabel);
vbox->addLayout(hbox);
}
vbox->addStretch(1);
hbox = new QHBoxLayout();
{
hbox->setSpacing(0);
hbox->addStretch(1);
m_statusLabel = new QLabel();
hbox->addWidget(m_statusLabel);
m_statusLabel->hide();
hbox->addStretch(1);
}
vbox->addLayout(hbox);
hbox = new QHBoxLayout();
{
hbox->setSpacing(0);
hbox->addStretch(1);
QPushButton *btn;
{
btn = new QPushButton("-");
btn->setStyleSheet("QPushButton {"
#ifdef Q_OS_ANDROID
"background: url(':/data/images/android-zoom-minus-button.png'); width: 117px; height: 47px; "
#else
"background: url(':/data/images/zoom-minus-button.png'); width: 58px; height: 24px; "
#endif
"padding:0; margin:0; border:none; color: transparent; outline: none; }");
btn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
btn->setAutoRepeat(true);
btn->setMaximumSize(117,48);
connect(btn, SIGNAL(clicked()), this, SLOT(zoomOut()));
hbox->addWidget(btn);
}
{
btn = new QPushButton("+");
btn->setStyleSheet("QPushButton {"
#ifdef Q_OS_ANDROID
"background: url(':/data/images/android-zoom-plus-button.png'); width: 117px; height: 47px; "
#else
"background: url(':/data/images/zoom-plus-button.png'); width: 58px; height: 24px; "
#endif
"padding:0; margin:0; border:none; color: transparent; outline: none; }");
btn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
btn->setAttribute(Qt::WA_TranslucentBackground, true);
btn->setAutoRepeat(true);
btn->setMaximumSize(117,48);
connect(btn, SIGNAL(clicked()), this, SLOT(zoomIn()));
hbox->addWidget(btn);
}
hbox->addStretch(1);
}
vbox->addLayout(hbox);
m_viewportLayout = vbox;
setViewport(viewport);
// Set a timer to update layout because it doesn't give buttons correct position right at the start
QTimer::singleShot(500, this, SLOT(updateViewportLayout()));
// Disable here because it interferes with the 'longpress' functionality in MapGraphicsScene
// FlickCharm *flickCharm = new FlickCharm(this);
// flickCharm->activateOn(this);
}