コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: igormacedo/subplayer
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
0
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
0
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
0
ファイル: RenderThemeQt.cpp プロジェクト: FilipBE/qtextended
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
0
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
0
ファイル: chatwidget.cpp プロジェクト: 654865468/QSanguosha
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
0
ファイル: dbasedialog.cpp プロジェクト: tsuibin/dde-desktop
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
0
ファイル: dashboard.cpp プロジェクト: StudioYFo/QSanguosha
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
0
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
0
MapGraphicsView::MapGraphicsView()
    : QGraphicsView()
{
#ifndef Q_OS_WIN
    srand ( time(NULL) );
#endif
    m_scaleFactor = 1.;

#ifndef QT_NO_OPENGL
    //setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
#endif

    setCacheMode(CacheBackground);
    //setViewportUpdateMode(BoundingRectViewportUpdate);
    //setRenderHint(QPainter::Antialiasing);
    //setTransformationAnchor(AnchorUnderMouse);
#ifdef Q_OS_ANDROID
    setTransformationAnchor(QGraphicsView::AnchorViewCenter);
#endif
    setResizeAnchor(AnchorViewCenter);
    setDragMode(QGraphicsView::ScrollHandDrag);

    setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform );
    // if there are ever graphic glitches to be found, remove this again
    setOptimizationFlags(QGraphicsView::DontAdjustForAntialiasing | QGraphicsView::DontClipPainter | QGraphicsView::DontSavePainterState);

    //setCacheMode(QGraphicsView::CacheBackground);
    //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);
}