Пример #1
0
Файл: MPF.cpp Проект: aaly/MPF
int MPF::showHelp()
{
    QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect(this);

    helpTextEdit->setGraphicsEffect(opacityEffect);
    //helpTextEdit->setText("");
    QPropertyAnimation* anim = new QPropertyAnimation(this);

    if(helpTextEdit->isHidden())
    {
        opacityEffect->setOpacity(1);
        anim->setEndValue(0);
        helpPushButton->setText(trUtf8("&Hide Help"));
        helpTextEdit->show();
        fullHelpPushButton->show();
    }
    else
    {
        opacityEffect->setOpacity(0);
        anim->setEndValue(1);
        helpPushButton->setText(trUtf8("&Show Help"));
        helpTextEdit->hide();
        fullHelpPushButton->hide();
    }

    anim->setTargetObject(opacityEffect);
    anim->setPropertyName("opacity");
    anim->setDuration(3000);
    anim->setStartValue(opacityEffect->opacity());
    anim->setEasingCurve(QEasingCurve::InBounce);
    anim->start(QAbstractAnimation::DeleteWhenStopped);

    return 0;
}
Пример #2
0
Файл: MPF.cpp Проект: aaly/MPF
int MPF::animateWidget(QWidget* widget, bool hide, int effect)
{
    if(!widget)
    {
        return 1;
    }

    if(effect == FADING)
    {
        QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect(this);
        opacityEffect->setOpacity(0);
        widget->setGraphicsEffect(opacityEffect);
        QPropertyAnimation* anim = new QPropertyAnimation(this);
        anim->setTargetObject(opacityEffect);
        anim->setPropertyName("opacity");
        anim->setDuration(3000);
        anim->setStartValue(opacityEffect->opacity());
        anim->setEndValue(1);
        anim->setEasingCurve(QEasingCurve::OutQuad);
        anim->start(QAbstractAnimation::DeleteWhenStopped);
    }


    return 0;
}
Пример #3
0
void LogoScene::setupLogo()
{
    Qneed* background = new Qneed(this, get_window());
    background->loadImage(":images/logo/logo_background.png");
    set_background(background);

    logo = new Qneed(this, get_window());
    logo->loadImage(":images/logo/logo.png");
    logo->setPos(307, 240);

    OnemoreButton* one = new OnemoreButton(this,get_window());
    one->setPos(400, 553);
    one->hide();

    QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect();
    opacityEffect->setOpacity(0.0);

    logo->setGraphicsEffect(opacityEffect);

    QPropertyAnimation * animation = new QPropertyAnimation();
    animation->setTargetObject(opacityEffect);
    animation->setPropertyName("opacity");
    animation->setDuration(2000);
    animation->setStartValue(0.0);
    animation->setEndValue(1.0);
    animation->setEasingCurve(QEasingCurve::OutQuad);

    connect(animation, SIGNAL(finished()), this, SLOT(goinit()));
    animation->start();
}
Пример #4
0
void ViewPlot::showPlot()
{
    QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
    effect->setOpacity(1);
    ui->frame->setGraphicsEffect(effect);
    delete effect;
}
Пример #5
0
CategorieButton::CategorieButton(QPixmap icon, QString name, QWidget *parent) : QWidget(parent) // This widget shows the icon and name of a menu's categorie
{
    resize(100, 100);
    isHovered = false;

    m_iconLabel = new QLabel(this);
    m_iconLabel->resize(size());
    m_iconLabel->setAlignment(Qt::AlignCenter);
    QPixmap modifiedIcon(48, 100);
    modifiedIcon.fill(Qt::transparent);
    QPainter p(&modifiedIcon);
    p.drawPixmap(0, 2, 48, 48, icon);
    QTransform t;
    p.drawPixmap(0, 50, 48, 48, icon.transformed(t.rotate(180, Qt::XAxis), Qt::SmoothTransformation));
    QLinearGradient alphaGradient(0, 0, 0, height());
    alphaGradient.setColorAt(0.0, Qt::black);
    alphaGradient.setColorAt(0.5, Qt::black);
    alphaGradient.setColorAt(0.8, Qt::transparent);
    QGraphicsOpacityEffect *iconEffect = new QGraphicsOpacityEffect(this);
    iconEffect->setOpacity(1);
    iconEffect->setOpacityMask(alphaGradient);
    m_iconLabel->setPixmap(modifiedIcon);
    m_iconLabel->setGraphicsEffect(iconEffect);

    m_nameLabel = new QLabel(name, this);
    m_nameLabel->setStyleSheet("color: white;");
    QGraphicsDropShadowEffect *nameEffect = new QGraphicsDropShadowEffect();
    nameEffect->setOffset(1);
    nameEffect->setColor(Qt::black);
    m_nameLabel->setGraphicsEffect(nameEffect);
    m_nameLabel->setAlignment(Qt::AlignCenter);
    m_nameLabel->setGeometry(0, 60, width(), m_nameLabel->height());
}
Пример #6
0
void MainForm::initLabels(){


    ui->label->setText(Config::MAIN_TITLE);
    //    ui->label_12->setText(Config::AREA_LABEL.split("#").at(0));
    //    ui->label_13->setText(Config::AREA_LABEL.split("#").at(1));
    //ui->stackedWidget_4->setCurrentIndex(0);

    QStackedLayout*laylout=(QStackedLayout*)ui->stackedWidget->layout();
    laylout->setStackingMode(QStackedLayout::StackAll);


    //QGraphicsOpacityEffect *effect1 = new QGraphicsOpacityEffect(this);
    //  effect1->setOpacity(0.8);
    // ui->widget_6->setStyleSheet("background-color:#000");
    // ui->widget_6->setGraphicsEffect(effect1);



    QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this);
    effect->setOpacity(0.9);
    // ui->widget_4->setStyleSheet("background-color:#fff");
    ui->widget_4->setGraphicsEffect(effect);


    //ui->widget->setStyleSheet("border-color:#fff;border-width:1px;border-style:solid");

    //ui->widget_8->isConnection(true);

}
Пример #7
0
void ImageView::updateOpacity()
{
	if(_image && _imageDepth)
	{
		if(_image->isVisible() && _imageDepth->isVisible())
		{
			QGraphicsOpacityEffect * effect = new QGraphicsOpacityEffect();
			QGraphicsOpacityEffect * effect2 = new QGraphicsOpacityEffect();
			effect->setOpacity(0.5);
			effect2->setOpacity(0.5);
			_image->setGraphicsEffect(effect);
			_imageDepth->setGraphicsEffect(effect2);
		}
		else
		{
			_image->setGraphicsEffect(0);
			_imageDepth->setGraphicsEffect(0);
		}
	}
	else if(_image)
	{
		_image->setGraphicsEffect(0);
	}
	else if(_imageDepth)
	{
		_imageDepth->setGraphicsEffect(0);
	}
}
Пример #8
0
ViewPlot::ViewPlot(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ViewPlot)
{
    ui->setupUi(this);

    this->setWindowFlags( Qt::Dialog |  Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint |
                          Qt::WindowSystemMenuHint | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint);
    ui->centralwidget->setStyleSheet("background-color: white;");
    stngViewPlot = new QSettings((QCoreApplication::applicationDirPath()) + "//configSanPasport.ini",QSettings::IniFormat);

    // Строка состояния
    sb1 = new QLabel(statusBar());
    ui->statusbar->setSizeGripEnabled(false);
    ui->statusbar->addWidget(sb1, 1);
    sb1->setText("");

    connect( ui->action_Open, SIGNAL(triggered()), SLOT(plotOpen()) );
    connect( ui->action_FileExport, SIGNAL(triggered()), SLOT(plotExport())  );
    connect( ui->action_CopyToBuffer, SIGNAL(triggered()), SLOT(copyToBuffer()) );
    connect( ui->action_Exit, SIGNAL(triggered()), SLOT(close()) );
    connect( ui->action_ConfizGraph, SIGNAL(triggered()), SLOT(showConfizGraph()) );
    connect( ui->action_Font, SIGNAL(triggered()), SLOT(settingFont()) );
    connect( ui->frame, SIGNAL(sgnlRazmer()), SLOT(plotSquare()) );

    // Подписи к осям
    ui->qwtPlot_spectrogram->axisScaleDraw(QwtPlot::xTop)->enableComponent(QwtScaleDraw::Labels, false);
    ui->qwtPlot_spectrogram->axisScaleDraw(QwtPlot::yRight)->enableComponent(QwtScaleDraw::Labels, false);
    ui->qwtPlot_spectrogram->setAxisEnableForAll(true);
    // Позиция курсора

    picker = new PlotZozPicker( ui->qwtPlot_spectrogram->canvas() );
    connect( picker, SIGNAL(position(QString)), SLOT(plotPos(QString)) );
    connect( ui->qwtPlot_spectrogram, SIGNAL(sgnlOutCanvas()), SLOT(plotPosReset())  );

    plotPosReset();
    // Кривая для легенды
    curve = new QwtPlotCurve();
    curve->setPen( Qt::red, 2 );
    curve->setLegendAttribute( QwtPlotCurve::LegendShowLine, true );
    curve->setLegendIconSize(QSize(30,2));
    curve->attach(ui->qwtPlot_spectrogram);
    // Легенда
    qwtLeg = new QwtLegend();
    qwtLeg->contentsWidget()->layout()->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    ui->qwtPlot_spectrogram->insertLegend( qwtLeg, QwtPlot::RightLegend);
    // Маркеры
    markerV = new PlotZozMarker(QwtPlotMarker::VLine);
    markerH = new PlotZozMarker(QwtPlotMarker::HLine);
    // Костыль - чтоб не мигал ратянутый график
    QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
    effect->setOpacity(0);
    ui->frame->setGraphicsEffect(effect);

    // Контекстное меню
    ui->frame->setContextMenuPolicy(Qt::CustomContextMenu);
    connect( ui->frame, SIGNAL(customContextMenuRequested(QPoint)), SLOT(contextMenuView(QPoint)) );
}
Пример #9
0
void Revrsi::change_tokenII(){
    vector<int> aniVec;
    if(!NetMode){
        aniVec = this->logic->getAniStones(-1);
    }
    else{
        aniVec = this->aninnn;
    }
    this->seqGroup = new QSequentialAnimationGroup;
    connect(this->seqGroup, SIGNAL(finished()), this, SLOT(setAnimationFinished()));
    for(uint i = 0; i < aniVec.size(); i+=2){
        if(i == aniVec.size()-1){
            break;
        }
        int k = 0;
        if(i==0){
            for(k = 0; k < this->tokens.size(); k++){
                if(this->tokens[k]->get_coords() == QPoint(aniVec[i],aniVec[i+1])){
                    this->tokens[k]->setVisible(true);
                    this->change_token_pixmap(this->tokens[k]);
                    break;
                }
            }
        }
        else if(aniVec[i] == -10){
            for(k = 0; k < this->tokens.size(); k++){
                if(this->tokens[k]->get_coords() == QPoint(aniVec[i+1],aniVec[i+2])){
                    this->tokens[k]->setVisible(true);
                    this->change_token_pixmap(this->tokens[k]);
                    break;
                }
            }
            i++;
        }
        else{
            for(k = 0; k < this->tokens.size(); k++){
                if(this->tokens[k]->get_coords() == QPoint(aniVec[i],aniVec[i+1])){
                    this->tokens[k]->setVisible(true);
                    this->change_token_pixmap(this->tokens[k]);
                    break;
                }
            }
        }
        QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
        this->tokens[k]->setGraphicsEffect(effect);
        effect->setOpacity(0.0);
        QPropertyAnimation *anim = new QPropertyAnimation(effect, "opacity");
        anim->setStartValue(0.0);
        anim->setEndValue(1.0);
        anim->setDuration(100);
        anim->setEasingCurve(QEasingCurve::InOutQuad);
        seqGroup->addAnimation(anim);
    }
    seqGroup->start(QAbstractAnimation::DeleteWhenStopped);
    for(int i=0; i < this->ai_list.size(); i++){
        this->ai_list[i]->animation_finished = false;
    }
}
Пример #10
0
void CustomSpinBox::setEnabled(bool b) {

	QGraphicsOpacityEffect *eff = new QGraphicsOpacityEffect;
	eff->setOpacity(b ? 1 : 0.5);
	this->setGraphicsEffect(eff);

	QSpinBox::setEnabled(b);

}
Пример #11
0
void CustomCheckBox::setEnabled(bool e) {

	QGraphicsOpacityEffect *eff = new QGraphicsOpacityEffect;

	eff->setOpacity(e ? 1 : 0.5);

	this->setGraphicsEffect(eff);

	QCheckBox::setEnabled(e);

}
Пример #12
0
void Hero::check_color(){
    QGraphicsColorizeEffect* colEffect = new QGraphicsColorizeEffect;
    QGraphicsOpacityEffect* opacity = new QGraphicsOpacityEffect;
    if(is_invulnerable){

        colEffect->setColor(Qt::magenta);
        graphics->setGraphicsEffect(colEffect);
    }else{
        opacity->setOpacity(1);
        graphics->setGraphicsEffect(opacity);
    }
}
Пример #13
0
PlayerOverlay::PlayerOverlay(Media::AVRecording* rec, QWidget* parent) : QWidget(parent),m_pRecording(rec)
{
   setupUi(this);
   m_pPlayer->setVisible(false);
   m_pDelete->setIcon( QIcon::fromTheme(QStringLiteral("edit-delete")) );
   m_pPlay->setIcon( QIcon::fromTheme( QStringLiteral("media-playback-start") ));
   QGraphicsOpacityEffect * effect = new QGraphicsOpacityEffect(m_pDelete);
   effect->setOpacity(0.3);
   m_pDelete->setGraphicsEffect(effect);
   effect = new QGraphicsOpacityEffect(m_pPlay);
   effect->setOpacity(0.3);
   m_pPlay->setGraphicsEffect(effect);
}
Пример #14
0
PlayerOverlay::PlayerOverlay(Call* call, QWidget* parent) : QWidget(parent),m_pCall(call)
{
   setupUi(this);
   m_pPlayer->setVisible(false);
   m_pDelete->setIcon( KIcon("edit-delete") );
   m_pPlay->setIcon( KIcon( "media-playback-start" ));
   QGraphicsOpacityEffect * effect = new QGraphicsOpacityEffect(m_pDelete);
   effect->setOpacity(0.3);
   m_pDelete->setGraphicsEffect(effect);
   effect = new QGraphicsOpacityEffect(m_pPlay);
   effect->setOpacity(0.3);
   m_pPlay->setGraphicsEffect(effect);
}
Пример #15
0
void RundownSonyPresetWidget::setUsed(bool used)
{
    if (used)
    {
        if (this->frameItem->graphicsEffect() == NULL)
        {
            QGraphicsOpacityEffect* effect = new QGraphicsOpacityEffect(this);
            effect->setOpacity(0.25);

            this->frameItem->setGraphicsEffect(effect);
        }
    }
    else
        this->frameItem->setGraphicsEffect(NULL);
}
Пример #16
0
void RundownPlayoutCommandWidget::setUsed(bool used)
{
    if (used)
    {
        if (this->graphicsEffect() == NULL)
        {
            QGraphicsOpacityEffect* effect = new QGraphicsOpacityEffect(this);
            effect->setOpacity(0.25);

            this->setGraphicsEffect(effect);
        }
    }
    else
        this->setGraphicsEffect(NULL);
}
ContactWidgetItem::ContactWidgetItem(const Akonadi::Item & item, QGraphicsWidget * parent)
    : Plasma::Frame(parent),
      m_edit(0),
      m_show(false),
      m_info(false)
{
    m_item = item;

    KABC::Addressee addressee = m_item.payload<KABC::Addressee>();

    m_addressee = new KABC::Addressee(addressee);

    m_mainLayout = new QGraphicsLinearLayout(Qt::Vertical, this);
    m_mainLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    m_edit = new Plasma::PushButton(this);
    m_edit->setMinimumHeight(25);
    m_edit->setMaximumHeight(25);
    m_edit->setText(i18n("Edit"));
    m_edit->hide();

    m_icon = new Plasma::IconWidget(this);
    m_icon->setOrientation(Qt::Horizontal);
    m_icon->setDrawBackground(true);
    m_icon->setMinimumSize(250, 50);
    m_icon->setMaximumHeight(50);

    setContactIcon();

    m_mainLayout->addItem(m_icon);

    setFrameShadow(Plasma::Frame::Raised);

    setLayout(m_mainLayout);

    QGraphicsOpacityEffect * effect = new QGraphicsOpacityEffect(this);
    effect->setOpacity(1);
    setGraphicsEffect(effect);

    m_animation = new QPropertyAnimation(effect, "opacity", effect);
    m_animation->setStartValue(0);
    m_animation->setEndValue(1);
    m_animation->setDuration(300);

    connect(m_animation, SIGNAL(finished()), this, SLOT(doHide()));
    connect(m_icon, SIGNAL(clicked()), SLOT(showContactInfo()));
    connect(m_edit, SIGNAL(clicked()), SLOT(editContact()));
}
void Manager::on_pushButton_Clear_clicked()
{
    //Clearing Text Fields
    progressBar->setValue(0);

    ui->lineEdit_Album->clear();
    ui->lineEdit_band_name->clear();
    ui->lineEdit_price_max->clear();
    ui->lineEdit_price_min->clear();
    ui->label_results->clear();

    Database conn;
    QSqlQueryModel * model = new QSqlQueryModel();

    conn.connOpen("Inventory");
    QSqlQuery * qry = new QSqlQuery(conn.mydb);
    progressBar->setValue(25);
    qry->prepare("SELECT * FROM Inventory");
    qry->exec();
    model->setQuery(*qry);
    ui->tableView_Master->setModel(model);

    ui->comboBox_Type->setCurrentIndex(0);
    progressBar->setValue(50);
    ui->checkBox_XS->setChecked(false);
    ui->checkBox_S->setChecked(false);
    ui->checkBox_M->setChecked(false);
    progressBar->setValue(75);
    ui->checkBox_L->setChecked(false);
    ui->checkBox_XL->setChecked(false);
    ui->checkBox_xxl->setChecked(false);
    progressBar->setValue(100);

    QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect(this);
         opacityEffect->setOpacity(1.0);
         ui->statusbar->setGraphicsEffect(opacityEffect);
         QPropertyAnimation* anim = new QPropertyAnimation(this);
         anim->setTargetObject(opacityEffect);
         anim->setPropertyName("opacity");
         anim->setDuration(4000);
         anim->setStartValue(opacityEffect->opacity());
         anim->setEndValue(0);
         anim->setEasingCurve(QEasingCurve::OutQuad);
         anim->start(QAbstractAnimation::DeleteWhenStopped);
    qDebug() << (model->rowCount());

}
Пример #19
0
/*!
    Constructor.
    
    \a parent Owner.
*/
HsSnapLine::HsSnapLine(QGraphicsItem *parent)
  : QGraphicsLineItem(parent),
    mFadeInAnimation(0),
    mFadeOutAnimation(0),
    mOpacity(0.0),
    mFadeInAnimationDuration(0),
    mFadeOutAnimationDuration(0)
{
    QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this);
    effect->setOpacity(0.0);
    effect->setEnabled(false);
    setGraphicsEffect(effect);

    mFadeInAnimation = new QPropertyAnimation(graphicsEffect(), "opacity", this);
    connect(mFadeInAnimation, SIGNAL(finished()), SLOT(fadeInAnimationFinished()));

    mFadeOutAnimation = new QPropertyAnimation(graphicsEffect(), "opacity", this);
    connect(mFadeOutAnimation, SIGNAL(finished()), SLOT(fadeOutAnimationFinished()));
}
Пример #20
0
View::View() {
    cities = new QStringListModel();

    search = new QLineEdit();
    search->setCompleter([this]() {
            QCompleter* completer = new QCompleter(cities);
            completer->setCaseSensitivity(Qt::CaseInsensitive);
            return completer;
        }());

    connect(search, SIGNAL(textEdited(const QString&)),
            this, SLOT(text_handler(const QString&)));

    go = new QPushButton(tr("Поиск"));
    connect(go, SIGNAL(clicked()), this, SLOT(go_handler()));

    // the next code is all about initializing stack of widgets
    QFile file(":resources/no_data.html");
    assert(file.open(QIODevice::ReadOnly | QIODevice::Text));

    no_data = new QWebView();
    no_data->setHtml(QTextStream(&file).readAll());
    no_data->setGraphicsEffect([]() {
            QGraphicsOpacityEffect* effect = new QGraphicsOpacityEffect();
            effect->setOpacity(1.0);
            return effect;
        }());

    weather = new QWebView();
    weather->setGraphicsEffect([]() {
            QGraphicsOpacityEffect* effect = new QGraphicsOpacityEffect();
            effect->setOpacity(1.0);
            return effect;
        }());

    info = new QStackedWidget();
    info->addWidget(no_data);
    info->addWidget(weather);
    info->setCurrentIndex(0);

    place_it();
}
void MainWindow::styleMacroBlocks(const int& mBlock)
{
    const int macBlockHeight = 16;
    const int macBlockWidth = 16;
    cooefsLink->setStyleSheet("background-color: transparent;");
    macBlockParent->setMinimumHeight(macBlockHeight);
    macBlockParent->setMinimumWidth(macBlockWidth);
    macBlockParent->setMaximumHeight(macBlockHeight);
    macBlockParent->setMaximumWidth(macBlockWidth);
    macBlock->stackUnder(cooefsLink);
    QString style = "border: 0.5px solid aqua; background-color:" 
                     + getSliceTypeColour((*macBlockPtr)[mBlock]) + ";";
    macBlock->setStyleSheet(style);
    macBlock->setAutoFillBackground(true);
    QGraphicsOpacityEffect* effect = 
                   new QGraphicsOpacityEffect(macBlock);
    effect->setOpacity(0.5);
    macBlock->setGraphicsEffect(effect);
    macBlock->show();
}
Пример #22
0
void Location::CutsceneView::CameraManipulatable::DrawCore(QGraphicsScene * pScene, QList<QGraphicsItem *> & addedItems)
{
    QBrush blackBrush(qRgba(0, 0, 0, 255));
    QPen blackPen(blackBrush, 4);
    QPen whitePen(QBrush(qRgba(255, 255, 255, 255)), 2);

    pOutsideCameraPathItem = new QGraphicsPathItem();
    pOutsideCameraPathItem->setBrush(blackBrush);

    QGraphicsOpacityEffect *pOutsideCameraOpacityEffect = new QGraphicsOpacityEffect();
    pOutsideCameraOpacityEffect->setOpacity(0.5);

    pOutsideCameraPathItem->setGraphicsEffect(pOutsideCameraOpacityEffect);

    pScene->addItem(pOutsideCameraPathItem);
    addedItems.append(pOutsideCameraPathItem);

    pCameraCenterHorizontalOuterLineItem = new QGraphicsLineItem();
    pCameraCenterVerticalOuterLineItem = new QGraphicsLineItem();
    pCameraCenterHorizontalInnerLineItem = new QGraphicsLineItem();
    pCameraCenterVerticalInnerLineItem = new QGraphicsLineItem();

    pCameraCenterHorizontalOuterLineItem->setPen(blackPen);
    pCameraCenterVerticalOuterLineItem->setPen(blackPen);
    pCameraCenterHorizontalInnerLineItem->setPen(whitePen);
    pCameraCenterVerticalInnerLineItem->setPen(whitePen);

    pCameraCenterGraphicsItemGroup = new QGraphicsItemGroup();
    pCameraCenterGraphicsItemGroup->addToGroup(pCameraCenterHorizontalOuterLineItem);
    pCameraCenterGraphicsItemGroup->addToGroup(pCameraCenterVerticalOuterLineItem);
    pCameraCenterGraphicsItemGroup->addToGroup(pCameraCenterHorizontalInnerLineItem);
    pCameraCenterGraphicsItemGroup->addToGroup(pCameraCenterVerticalInnerLineItem);

    pCameraCenterOpacityEffect = new QGraphicsOpacityEffect();
    pCameraCenterOpacityEffect->setOpacity(1.0);

    pCameraCenterGraphicsItemGroup->setGraphicsEffect(pCameraCenterOpacityEffect);

    pScene->addItem(pCameraCenterGraphicsItemGroup);
    addedItems.append(pCameraCenterGraphicsItemGroup);
}
void MainWindow::constructMotionVector(int mBlock)
{
    mv = new MotionVectorDisplay(pics[frameCounter].motionVect, 
                                 pics[frameCounter].subMotionVector[mBlock],
                                 brushColour,
                                 macBlockParent);
    mv->stackUnder(cooefsLink);
    macBlock->stackUnder(mv);
    QGraphicsOpacityEffect* effect = 
            new QGraphicsOpacityEffect(mv);
    effect->setOpacity(0.9);
    mv->setGraphicsEffect(effect);
    if(mvToggle->checkState() == Qt::Checked)
    {
        mv->show();
    }
    else
    {
        mv->hide();
    }
    motionVectorsContain.push_back(mv);
}
void OverviewDockWidget::highlightSearchResultItems(QList<OwlClass *> cls)
{
    if(!this->searchResultHighlights.empty()){
        for(int i=0;i<searchResultHighlights.size();i++)
            m_scene->removeItem(searchResultHighlights[i]);
        searchResultHighlights.clear();
    }
    for(int i=0;i<cls.size();i++){
        double x = cls[i]->overviewshape->pos().rx()-4.2;
        double y = cls[i]->overviewshape->pos().ry()-4.2;
        QRectF viewRect = QRectF(x,y,8,8);
        QPen p(Qt::transparent);
        QBrush b(QColor("orange"),Qt::SolidPattern);

        QGraphicsItem *it = m_scene->addRect(viewRect,p,b);
        QGraphicsOpacityEffect *ef = new QGraphicsOpacityEffect(this);
        ef->setOpacity(0.8);
        it->setGraphicsEffect(ef);

        searchResultHighlights.append(it);
    }
}
Пример #25
0
Glass::Glass()
{
    // окно
    glass = new QLabel();
    glass->setStyleSheet("background-color: rgb(0, 0, 0);");
    glass->setAutoFillBackground(true);

    // текст
    infoTextContaiter = new QLabel();
    infoTextContaiter->setStyleSheet("color: rgb(255, 255, 255);");
    QFont font = infoTextContaiter->font();
    font.setBold(true);
    infoTextContaiter->setFont(font);

    // анимация
    animationContainer = new QLabel();
    movie = new QMovie(":/animations/loading");
    animationContainer->setMovie(movie);

    // эффект прозрачности
    QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect();
    effect->setOpacity(0.7);
    glass->setGraphicsEffect(effect);
}
Пример #26
0
void FutureProgressPrivate::fadeAway()
{
    m_isFading = true;

    QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect;
    opacityEffect->setOpacity(1.);
    m_q->setGraphicsEffect(opacityEffect);

    QSequentialAnimationGroup *group = new QSequentialAnimationGroup(this);
    QPropertyAnimation *animation = new QPropertyAnimation(opacityEffect, "opacity");
    animation->setDuration(StyleHelper::progressFadeAnimationDuration);
    animation->setEndValue(0.);
    group->addAnimation(animation);
    animation = new QPropertyAnimation(m_q, "maximumHeight");
    animation->setDuration(120);
    animation->setEasingCurve(QEasingCurve::InCurve);
    animation->setStartValue(m_q->sizeHint().height());
    animation->setEndValue(0.0);
    group->addAnimation(animation);

    connect(group, &QAbstractAnimation::finished, m_q, &FutureProgress::removeMe);
    group->start(QAbstractAnimation::DeleteWhenStopped);
    emit m_q->fadeStarted();
}
void Manager::on_pushButton_clicked()
{
    progressBar->setValue(0);
    Database conn;
    QSqlQueryModel * model = new QSqlQueryModel();

    conn.connOpen("Inventory");
    QSqlQuery * qry = new QSqlQuery(conn.mydb);


    QString Band_Name = ui->lineEdit_band_name->text();
    QString Album = ui->lineEdit_Album->text();
    QString Type = ui->comboBox_Type->currentText();
    qint32 minPrice = 0;
    if(!ui->lineEdit_price_min->text().isEmpty())
        minPrice = ui->lineEdit_price_min->text().toInt();
    qint32 maxPrice = 99999;
    progressBar->setValue(25);
    if(!ui->lineEdit_price_max->text().isEmpty())
        maxPrice = ui->lineEdit_price_max->text().toInt();

    if(Type == "Select a Type")
        Type = "";

    qint32 xs_int = 999;
    qint32 s_int = 999;
    qint32 m_int = 999;
    qint32 l_int = 999;
    qint32 xl_int = 999;
    qint32 xxl_int = 999;
    progressBar->setValue(50);
    if(!ui->checkBox_XS->isChecked() && !ui->checkBox_S->isChecked() && !ui->checkBox_M->isChecked() &&
            !ui->checkBox_L->isChecked() && !ui->checkBox_XL->isChecked() && !ui->checkBox_xxl->isChecked())
    {
        QString queryString;
        QTextStream queryStream(&queryString);
        queryStream
                << "SELECT * FROM Inventory WHERE \"Price\" >= '"
                << minPrice << "' AND \"Price\" <= '"
                << maxPrice << "' AND Band LIKE '%"+Band_Name+"%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%'";
        qry->prepare(queryString);
    }
    else
    {
        if(ui->checkBox_XS->isChecked())
            xs_int = 0;
        if(ui->checkBox_S->isChecked())
            s_int = 0;
        if(ui->checkBox_M->isChecked())
            m_int = 0;
        if(ui->checkBox_L->isChecked())
            l_int = 0;
        if(ui->checkBox_XL->isChecked())
            xl_int = 0;
        if(ui->checkBox_xxl->isChecked())
            xxl_int = 0;

        QString queryString;
        QTextStream queryStream(&queryString);

        queryStream
                << "SELECT * FROM Inventory WHERE \"XS(Quantity)\" > '"
                   << xs_int << "' AND \"Price\" >= '"
                   << minPrice << "' AND \"Price\" <= '"
                   << maxPrice << "' AND Band LIKE '%" << Band_Name << "%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%' OR \"S(Quantity)\" > '"
                   << s_int << "' AND \"Price\" >= '"
                   << minPrice << "' AND \"Price\" <= '"
                   << maxPrice << "' AND Band LIKE '%" << Band_Name << "%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%' OR \"M(Quantity)\" > '"
                   << m_int << "' AND \"Price\" >= '"
                   << minPrice << "' AND \"Price\" <= '"
                   << maxPrice << "' AND Band LIKE '%" << Band_Name << "%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%' OR \"L(Quantity)\" > '"
                   << l_int << "' AND \"Price\" >= '"
                   << minPrice << "' AND \"Price\" <= '"
                   << maxPrice << "' AND Band LIKE '%" << Band_Name << "%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%' OR \"XL(Quantity)\" > '"
                   << xl_int << "' AND \"Price\" >= '"
                   << minPrice << "' AND \"Price\" <= '"
                   << maxPrice << "' AND Band LIKE '%" << Band_Name << "%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%' OR \"XXL(Quantity)\" > '"
                   << xxl_int << "' AND \"Price\" >= '"
                   << minPrice << "' AND \"Price\" <= '"
                   << maxPrice << "' AND Band LIKE '%" << Band_Name << "%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%'";
        qry->prepare(queryString);

    }
    progressBar->setValue(75);

    if(!qry->exec())
    {
        QMessageBox::critical(this, tr("Error"), qry->lastError().text());
    }
    model->setQuery(*qry);
    ui->tableView_Master->setModel(model);

    qint32 i = (model->rowCount());
    QString str;

    str.append(QString("%1").arg(i));
    progressBar->setValue(100);

    QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect(this);
         opacityEffect->setOpacity(1.0);
         ui->statusbar->setGraphicsEffect(opacityEffect);
         QPropertyAnimation* anim = new QPropertyAnimation(this);
         anim->setTargetObject(opacityEffect);
         anim->setPropertyName("opacity");
         anim->setDuration(4000);
         anim->setStartValue(opacityEffect->opacity());
         anim->setEndValue(0);
         anim->setEasingCurve(QEasingCurve::OutQuad);
         anim->start(QAbstractAnimation::DeleteWhenStopped);


    ui->label_results->setText(str + " Results Found!");

}
Пример #28
0
void PowerPlantModeWidget::Refresh() {

    // Reset selected card
    selectedCard = nullptr;

    // Load power plant cards
    auto marketCards = Game::getInstance().GetCardStack().GetVisibleCards();

    // Clear old components
    while(cards.size() > 0) {
        gridLayout->removeWidget(cards[0]);
        delete cards[0];
        cards.erase(cards.begin());
    }

    // Dummy cards
    for (int i = 0; i < marketCards.size(); i++) {
        QPushButton *card = new QPushButton();
        card->setObjectName("powerPlantCardButton");
        card->setIcon(QIcon(marketCards[i]->GetImagePath().c_str()));
        card->setIconSize(QSize(200, 200));
        cards.push_back(card);

        // Fade the future market
        if (i >= Game::getInstance().GetCardStack().futureMarketIndex) {
            QGraphicsOpacityEffect * effect = new QGraphicsOpacityEffect(this);
            effect->setOpacity(0.25);
            card->setGraphicsEffect(effect);
        
        } else if (Game::getInstance().GetStep() == 2
            && Game::getInstance().GetNowBidding()
            && Game::getInstance().GetPlantIndex() != i) {
        
            QGraphicsOpacityEffect * effect = new QGraphicsOpacityEffect(this);
            effect->setOpacity(0.55);
            cards[i]->setGraphicsEffect(effect);
        }

        // Only first row
        if (i < Game::getInstance().GetCardStack().futureMarketIndex) {
        
            // If step 2
            if (Game::getInstance().GetStep() == 2 && !Game::getInstance().GetNowBidding()) {

                // Connect
                connect(cards[i], &QPushButton::clicked, [=]() {
                    qDebug(string("Card " + std::to_string(i) + " clicked!").c_str());

                    // Make all other cards faded
                    for (int j = 0; j < Game::getInstance().GetCardStack().futureMarketIndex; j++) {
                        QGraphicsOpacityEffect * effect = new QGraphicsOpacityEffect(this);
                        if(cards[j] != cards[i])
                            effect->setOpacity(0.55);
                        else
                            effect->setOpacity(1);
                        cards[j]->setGraphicsEffect(effect);
                    }

                    selectedCard = cards[i];
                    selectedCard->repaint();

                    emit CardSelected(i);
                });
            }
        }
    }

    // Add components
    for (int i = 0; i < cards.size(); i++) {
        gridLayout->addWidget(cards[i], i / per_row, i%per_row, Qt::AlignCenter);
    }
}
Пример #29
0
void LayerControlWidgetBase::initUi(bool hasContent, bool showRemove)
{
  // object name for custom stylesheets
  setObjectName("oeItem");

  // create the primary vertical layout
  _primaryLayout = new QVBoxLayout;
  _primaryLayout->setSpacing(0);
  _primaryLayout->setContentsMargins(0, 0, 0, 0);
  setLayout(_primaryLayout);


  //create drop decoration box
  _dropBox = new QFrame;
  QVBoxLayout* dbLayout = new QVBoxLayout();
  dbLayout->setSpacing(0);
  dbLayout->setContentsMargins(0, 0, 0, 0);
  _dropBox->setLayout(dbLayout);

  QFrame* dropBoxInternal = new QFrame();
  dropBoxInternal->setFixedHeight(40);
  dropBoxInternal->setObjectName("oeDropTarget");
  dbLayout->addWidget(dropBoxInternal);
  dbLayout->addSpacing(4);

  QGraphicsOpacityEffect* dbEffect = new QGraphicsOpacityEffect(_dropBox);
  dbEffect->setOpacity(0.35);
  _dropBox->setGraphicsEffect(dbEffect);
  _dropBox->setVisible(false);
  _primaryLayout->addWidget(_dropBox);


  // create the header boxes and layouts
  _headerBox = new QFrame;
  _headerBoxLayout = new QHBoxLayout;
  //_headerBoxLayout->setSpacing(4);
  //_headerBoxLayout->setContentsMargins(2, 2, 2, 2);
  _headerBox->setLayout(_headerBoxLayout);

  _headerTitleBox = new QFrame;
  _headerTitleBoxLayout = new QHBoxLayout;
  _headerTitleBoxLayout->setSpacing(4);
  _headerTitleBoxLayout->setContentsMargins(2, 2, 2, 2);
  _headerTitleBox->setLayout(_headerTitleBoxLayout);
  _headerBoxLayout->addWidget(_headerTitleBox);

  _headerBoxLayout->addStretch();

  _headerButtonBox = new QFrame;
  _headerButtonBoxLayout = new QHBoxLayout;
  //_headerButtonBoxLayout->setSpacing(4);
  _headerButtonBoxLayout->setContentsMargins(2, 2, 2, 2);
  _headerButtonBox->setLayout(_headerButtonBoxLayout);
  _headerBoxLayout->addWidget(_headerButtonBox);

  if (showRemove)
  {
    // add remove button to the header button box
    _removeButton = new QPushButton(QIcon(":/images/close.png"), tr(""));
    _removeButton->setFlat(true);
    _removeButton->setMaximumSize(16, 16);
    _headerButtonBoxLayout->addWidget(_removeButton);

    connect(_removeButton, SIGNAL(clicked(bool)), this, SLOT(onRemoveClicked(bool)));
  }

  _primaryLayout->addWidget(_headerBox);


  // create the content box and layout
  if (hasContent)
  {
    _headerBox->setObjectName("oeItemHeader");

    _contentBox = new QFrame();
    _contentBoxLayout = new QHBoxLayout;
    _contentBoxLayout->setContentsMargins(4, 4, 4, 4);
    _contentBox->setLayout(_contentBoxLayout);
    _primaryLayout->addWidget(_contentBox);
  }

  setAcceptDrops(true); 
}
Пример #30
0
void MainWindow::setupUi()
{
    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->setSpacing(0);
    mainLayout->setMargin(0);
    setLayout(mainLayout);

    mpPlayerLayout = new QVBoxLayout();
    mpControl = new QWidget(this);
    mpControl->setMaximumHeight(25);

    //mpPreview = new QLable(this);

    mpTimeSlider = new Slider(mpControl);
    mpTimeSlider->setDisabled(true);
    //mpTimeSlider->setFixedHeight(8);
    mpTimeSlider->setMaximumHeight(8);
    mpTimeSlider->setTracking(true);
    mpTimeSlider->setOrientation(Qt::Horizontal);
    mpTimeSlider->setMinimum(0);
#if SLIDER_ON_VO
    QGraphicsOpacityEffect *oe = new QGraphicsOpacityEffect(this);
    oe->setOpacity(0.5);
    mpTimeSlider->setGraphicsEffect(oe);
#endif //SLIDER_ON_VO

    mpCurrent = new QLabel(mpControl);
    mpCurrent->setToolTip(tr("Current time"));
    mpCurrent->setMargin(2);
    mpCurrent->setText("00:00:00");
    mpEnd = new QLabel(mpControl);
    mpEnd->setToolTip(tr("Duration"));
    mpEnd->setMargin(2);
    mpEnd->setText("00:00:00");
    mpTitle = new QLabel(mpControl);
    mpTitle->setToolTip(tr("Render engine"));
    mpTitle->setText("QPainter");
    mpTitle->setIndent(8);
    mpSpeed = new QLabel("1.00");
    mpSpeed->setMargin(1);
    mpSpeed->setToolTip(tr("Speed. Ctrl+Up/Down"));

    mPlayPixmap = QPixmap(":/theme/button-play-pause.png");
    int w = mPlayPixmap.width(), h = mPlayPixmap.height();
    mPausePixmap = mPlayPixmap.copy(QRect(w/2, 0, w/2, h));
    mPlayPixmap = mPlayPixmap.copy(QRect(0, 0, w/2, h));
    qDebug("%d x %d", mPlayPixmap.width(), mPlayPixmap.height());
    mpPlayPauseBtn = new Button(mpControl);
    int a = qMin(w/2, h);
    const int kMaxButtonIconWidth = 20;
    const int kMaxButtonIconMargin = kMaxButtonIconWidth/3;
    a = qMin(a, kMaxButtonIconWidth);
    mpPlayPauseBtn->setIconWithSates(mPlayPixmap);
    mpPlayPauseBtn->setIconSize(QSize(a, a));
    mpPlayPauseBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin);
    mpStopBtn = new Button(mpControl);
    mpStopBtn->setIconWithSates(QPixmap(":/theme/button-stop.png"));
    mpStopBtn->setIconSize(QSize(a, a));
    mpStopBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin);
    mpBackwardBtn = new Button(mpControl);
    mpBackwardBtn->setIconWithSates(QPixmap(":/theme/button-rewind.png"));
    mpBackwardBtn->setIconSize(QSize(a, a));
    mpBackwardBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin);
    mpForwardBtn = new Button(mpControl);
    mpForwardBtn->setIconWithSates(QPixmap(":/theme/button-fastforward.png"));
    mpForwardBtn->setIconSize(QSize(a, a));
    mpForwardBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin);
    mpOpenBtn = new Button(mpControl);
    mpOpenBtn->setToolTip(tr("Open"));
    mpOpenBtn->setIconWithSates(QPixmap(":/theme/open_folder.png"));
    mpOpenBtn->setIconSize(QSize(a, a));
    mpOpenBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin);

    mpInfoBtn = new Button();
    mpInfoBtn->setToolTip(QString("Media information. Not implemented."));
    mpInfoBtn->setIconWithSates(QPixmap(":/theme/info.png"));
    mpInfoBtn->setIconSize(QSize(a, a));
    mpInfoBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin);
    mpCaptureBtn = new Button();
    mpCaptureBtn->setIconWithSates(QPixmap(":/theme/screenshot.png"));
    mpCaptureBtn->setIconSize(QSize(a, a));
    mpCaptureBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin);
    mpVolumeBtn = new Button();
    mpVolumeBtn->setIconWithSates(QPixmap(":/theme/button-max-volume.png"));
    mpVolumeBtn->setIconSize(QSize(a, a));
    mpVolumeBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin);

    mpVolumeSlider = new Slider();
    mpVolumeSlider->hide();
    mpVolumeSlider->setOrientation(Qt::Horizontal);
    mpVolumeSlider->setMinimum(0);
    const int kVolumeSliderMax = 100;
    mpVolumeSlider->setMaximum(kVolumeSliderMax);
    mpVolumeSlider->setMaximumHeight(8);
    mpVolumeSlider->setMaximumWidth(88);
    mpVolumeSlider->setValue(int(1.0/kVolumeInterval*qreal(kVolumeSliderMax)/100.0));
    setVolume();

    mpMenuBtn = new Button();
    mpMenuBtn->setAutoRaise(true);
    mpMenuBtn->setPopupMode(QToolButton::InstantPopup);

/*
    mpMenuBtn->setIconWithSates(QPixmap(":/theme/search-arrow.png"));
    mpMenuBtn->setIconSize(QSize(a, a));
    mpMenuBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin);
*/
    QMenu *subMenu = 0;
    QWidgetAction *pWA = 0;
    mpMenu = new QMenu(mpMenuBtn);
    mpMenu->addAction(tr("Open Url"), this, SLOT(openUrl()));
    //mpMenu->addAction(tr("Online channels"), this, SLOT(onTVMenuClick()));
    mpMenu->addSeparator();

    subMenu = new QMenu(tr("Play list"));
    mpMenu->addMenu(subMenu);
    mpPlayList = new PlayList(this);
    mpPlayList->setSaveFile(Config::instance().defaultDir() + "/playlist.qds");
    mpPlayList->load();
    connect(mpPlayList, SIGNAL(aboutToPlay(QString)), SLOT(play(QString)));
    pWA = new QWidgetAction(0);
    pWA->setDefaultWidget(mpPlayList);
    subMenu->addAction(pWA); //must add action after the widget action is ready. is it a Qt bug?

    subMenu = new QMenu(tr("History"));
    mpMenu->addMenu(subMenu);
    mpHistory = new PlayList(this);
    mpHistory->setMaxRows(20);
    mpHistory->setSaveFile(Config::instance().defaultDir() + "/history.qds");
    mpHistory->load();
    connect(mpHistory, SIGNAL(aboutToPlay(QString)), SLOT(play(QString)));
    pWA = new QWidgetAction(0);
    pWA->setDefaultWidget(mpHistory);
    subMenu->addAction(pWA); //must add action after the widget action is ready. is it a Qt bug?

    mpMenu->addSeparator();

    //mpMenu->addAction(tr("Report"))->setEnabled(false); //report bug, suggestions etc. using maillist?
    mpMenu->addAction(tr("About"), this, SLOT(about()));
    mpMenu->addAction(tr("Help"), this, SLOT(help()));
    mpMenu->addAction(tr("About Qt"), qApp, SLOT(aboutQt()));
    mpMenu->addAction(tr("Donate"), this, SLOT(donate()));
    mpMenu->addAction(tr("Setup"), this, SLOT(setup()));
    mpMenu->addSeparator();
    mpMenuBtn->setMenu(mpMenu);
    mpMenu->addSeparator();

    subMenu = new QMenu(tr("Speed"));
    mpMenu->addMenu(subMenu);
    QDoubleSpinBox *pSpeedBox = new QDoubleSpinBox(0);
    pSpeedBox->setRange(0.01, 20);
    pSpeedBox->setValue(1.0);
    pSpeedBox->setSingleStep(0.01);
    pSpeedBox->setCorrectionMode(QAbstractSpinBox::CorrectToPreviousValue);
    pWA = new QWidgetAction(0);
    pWA->setDefaultWidget(pSpeedBox);
    subMenu->addAction(pWA); //must add action after the widget action is ready. is it a Qt bug?

    subMenu = new ClickableMenu(tr("Repeat"));
    mpMenu->addMenu(subMenu);
    //subMenu->setEnabled(false);
    mpRepeatEnableAction = subMenu->addAction(tr("Enable"));
    mpRepeatEnableAction->setCheckable(true);
    connect(mpRepeatEnableAction, SIGNAL(toggled(bool)), SLOT(toggleRepeat(bool)));
    // TODO: move to a func or class
    mpRepeatBox = new QSpinBox(0);
    mpRepeatBox->setMinimum(-1);
    mpRepeatBox->setValue(-1);
    mpRepeatBox->setToolTip("-1: " + tr("infinity"));
    connect(mpRepeatBox, SIGNAL(valueChanged(int)), SLOT(setRepeateMax(int)));
    QLabel *pRepeatLabel = new QLabel(tr("Times"));
    QHBoxLayout *hb = new QHBoxLayout;
    hb->addWidget(pRepeatLabel);
    hb->addWidget(mpRepeatBox);
    QVBoxLayout *vb = new QVBoxLayout;
    vb->addLayout(hb);
    pRepeatLabel = new QLabel(tr("From"));
    mpRepeatA = new QTimeEdit();
    mpRepeatA->setDisplayFormat("HH:mm:ss");
    mpRepeatA->setToolTip(tr("negative value means from the end"));
    connect(mpRepeatA, SIGNAL(timeChanged(QTime)), SLOT(repeatAChanged(QTime)));
    hb = new QHBoxLayout;
    hb->addWidget(pRepeatLabel);
    hb->addWidget(mpRepeatA);
    vb->addLayout(hb);
    pRepeatLabel = new QLabel(tr("To"));
    mpRepeatB = new QTimeEdit();
    mpRepeatB->setDisplayFormat("HH:mm:ss");
    mpRepeatB->setToolTip(tr("negative value means from the end"));
    connect(mpRepeatB, SIGNAL(timeChanged(QTime)), SLOT(repeatBChanged(QTime)));
    hb = new QHBoxLayout;
    hb->addWidget(pRepeatLabel);
    hb->addWidget(mpRepeatB);
    vb->addLayout(hb);
    QWidget *pRepeatWidget = new QWidget;
    pRepeatWidget->setLayout(vb);

    pWA = new QWidgetAction(0);
    pWA->setDefaultWidget(pRepeatWidget);
    pWA->defaultWidget()->setEnabled(false);
    subMenu->addAction(pWA); //must add action after the widget action is ready. is it a Qt bug?
    mpRepeatAction = pWA;

    mpMenu->addSeparator();

    subMenu = new ClickableMenu(tr("Subtitle"));
    mpMenu->addMenu(subMenu);
    QAction *act = subMenu->addAction(tr("Enable"));
    act->setCheckable(true);
    act->setChecked(mpSubtitle->isEnabled());
    connect(act, SIGNAL(toggled(bool)), SLOT(toggoleSubtitleEnabled(bool)));
    act = subMenu->addAction(tr("Auto load"));
    act->setCheckable(true);
    act->setChecked(mpSubtitle->autoLoad());
    connect(act, SIGNAL(toggled(bool)), SLOT(toggleSubtitleAutoLoad(bool)));
    subMenu->addAction(tr("Open"), this, SLOT(openSubtitle()));
    QWidget *csWidget = new QWidget();
    hb = new QHBoxLayout();
    csWidget->setLayout(hb);
    hb->addWidget(new QLabel(tr("Charset")));
    QComboBox *csBox = new QComboBox();
    hb->addWidget(csBox);
    pWA = new QWidgetAction(0);
    pWA->setDefaultWidget(csWidget);
    subMenu->addAction(pWA); //must add action after the widget action is ready. is it a Qt bug?
    csBox->addItem(tr("Auto detect"), "AutoDetect");
    csBox->addItem(tr("System"), "System");
    foreach (QByteArray cs, QTextCodec::availableCodecs()) {
        csBox->addItem(cs, cs);
    }