Esempio n. 1
0
/*virtual*/
bool ChoiceFilter::eventFilter(QObject *obj, QEvent *event)
{
    QPalette palette;
    QLabel *label;

    if (event->type() == QEvent::Enter) {
        label = qobject_cast<QLabel*>(obj);
        palette = label->palette();
        this->usualColor = palette.color(QPalette::Text);
        palette.setColor(label->foregroundRole(), QColor(Qt::cyan));
        label->setPalette(palette);

        return true;
    }

    if (event->type() == QEvent::Leave) {
        label = qobject_cast<QLabel*>(obj);
        palette = label->palette();
        palette.setColor(label->foregroundRole(), this->usualColor);
        label->setPalette(palette);

        return true;
    }
    return false;
}
Esempio n. 2
0
void WelcomePageButtonPrivate::doUpdate(bool cursorInside)
{
    const bool active = isActive();
    q->setPalette(buttonPalette(active, cursorInside, false));
    const QPalette lpal = buttonPalette(active, cursorInside, true);
    m_label->setPalette(lpal);
    if (m_icon)
        m_icon->setPalette(lpal);
    q->update();
}
Esempio n. 3
0
/**
 * Shows a context menu for the layer widget. Launched with a right click.
 */
void QG_LayerWidget::contextMenuEvent(QContextMenuEvent *e) {

    if (actionHandler) {
        QMenu* contextMenu = new QMenu(this);
        QLabel* caption = new QLabel(tr("Layer Menu"), this);
        QPalette palette;
        palette.setColor(caption->backgroundRole(), RS_Color(0,0,0));
        palette.setColor(caption->foregroundRole(), RS_Color(255,255,255));
        caption->setPalette(palette);
        caption->setAlignment( Qt::AlignCenter );
        contextMenu->addAction( tr("&Defreeze all Layers"), actionHandler,
                                 SLOT(slotLayersDefreezeAll()), 0);
        contextMenu->addAction( tr("&Freeze all Layers"), actionHandler,
                                 SLOT(slotLayersFreezeAll()), 0);
        contextMenu->addSeparator();
        contextMenu->addAction( tr("&Add Layer"), actionHandler,
                                 SLOT(slotLayersAdd()), 0);
        contextMenu->addAction( tr("&Remove Layer"), actionHandler,
                                 SLOT(slotLayersRemove()), 0);
        contextMenu->addAction( tr("Edit Layer &Attributes"), actionHandler,
                                 SLOT(slotLayersEdit()), 0);
        contextMenu->addAction( tr("Toggle Layer &Visibility"), actionHandler,
                                 SLOT(slotLayersToggleView()), 0);
        contextMenu->addAction( tr("Toggle Layer &Printing"), actionHandler,
                                 SLOT(slotLayersTogglePrint()), 0);
        contextMenu->addAction( tr("Toggle &Construction Layer"), actionHandler,
                                 SLOT(slotLayersToggleConstruction()), 0);
        contextMenu->exec(QCursor::pos());
        delete contextMenu;
    }

    e->accept();
}
Esempio n. 4
0
void TimeAnalysisWidget::updateLegend()
{
    std::vector<std::string> &labels = _selectedScalar->labels();

    // removinb previous legend
    QFormLayout *layout = (QFormLayout *)_ui->legendGroupBox->layout();
    QLayoutItem *child;
    while (layout->count()!=0 && (child = layout->takeAt(0)) != 0) {
        child->widget()->deleteLater();
        delete child;
    }

    for (unsigned i=0; i<labels.size(); ++i) {
        QLabel *colorLabel = new QLabel;
        colorLabel->setAutoFillBackground(true);
        colorLabel->setMinimumSize(70, 15);
        QPalette palette = colorLabel->palette();

        float denom = _selectedScalar->max() - _selectedScalar->min();
        float normalizedValue = ( i - _selectedScalar->min() ) / ( denom == 0 ? 1.f : denom );

        palette.setColor(colorLabel->backgroundRole(), _ui->projectionWidget->colorScale()->getColor(normalizedValue));
        colorLabel->setPalette(palette);

        layout->addRow(new QLabel(labels[i].c_str()), colorLabel);
    }

    repaint();
}
Esempio n. 5
0
PrimeDialog::PrimeDialog(QWidget* parent) :
    QDialog(parent) {

    QPalette pe;
    pe.setColor(QPalette::WindowText,Qt::blue);
    QLabel* remindLabel = new QLabel;
    remindLabel->setText(QString(tr("请给定一个大数")));
    QLabel* primeLabel = new QLabel(tr("大数:"));
    primeLabel->setPalette(pe);
    primeEdit = new QLineEdit;
    showLabel = new QLabel;

    QGridLayout* gridLayout = new QGridLayout;
    gridLayout->addWidget(remindLabel,  0, 0, 1, 4);
    gridLayout->addWidget(primeLabel,   1, 0, 1, 1, Qt::AlignLeft);
    gridLayout->addWidget(primeEdit,    1, 1, 1, 3);
    gridLayout->addWidget(showLabel,    2, 0, 1, 4);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    buttonBox->button(QDialogButtonBox::Ok)->setText(CALCULATE);
    buttonBox->button(QDialogButtonBox::Cancel)->setText(CANCEL);
    buttonBox->setCenterButtons(true);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(calculate()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QVBoxLayout* dlgLayout = new QVBoxLayout;
    dlgLayout->setMargin(10);
    dlgLayout->addLayout(gridLayout);
    dlgLayout->addStretch(40);
    dlgLayout->addWidget(buttonBox);
    this->setLayout(dlgLayout);
    this->setFixedSize(300,200);
    this->setWindowTitle(PRIME_TEST);
}
void FlashableWidget::labelOff(int row, int column)
{
    int index = column + row*width_;
    QLabel* label = vLabels_.at(index);
    label->setPalette(inactiveLabelPalette);
    vActiveLabels_.remove(vActiveLabels_.indexOf(label));
}
Esempio n. 7
0
void InfoPane::createLabels(const QString& title, const QString& value, const int num_cols, int& x, int& y)
{
	QLabel* labelTitle = new QLabel(title, this);
	labelTitle->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
	labelTitle->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);

	QPalette palette = labelTitle->palette();
	QColor f = palette.color(QPalette::Foreground);
	f.setAlpha(128);
	palette.setColor(QPalette::Foreground, f);
	labelTitle->setPalette(palette);

	gridLayout().addWidget(labelTitle, y, x, 1, 1);

	QLabel* labelValue = new QLabel(value, this);
	labelValue->setTextInteractionFlags(Qt::TextBrowserInteraction);
	labelValue->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
	gridLayout().addWidget(labelValue, y, x + 1, 1, 1);

	x += 2;

	if (x % num_cols == 0)
	{
		x = 0;
		y++;
	}
}
bool FlashableWidget::oneByOneSearch()
{
    QLabel* lastLabel;
    if(oneByOneIndex_ == 0)
        lastLabel = vLabels_.last();
    else
        lastLabel = vLabels_.at(oneByOneIndex_-1);

    lastLabel->setPalette(inactiveLabelPalette);
    if(vActiveLabels_.contains(lastLabel))
        vActiveLabels_.remove(vActiveLabels_.indexOf(lastLabel));

    if( oneByOneIndex_ != vLabels_.size())
    {
        vActiveLabels_.push_back(vLabels_.at(oneByOneIndex_));
        vLabels_.at(oneByOneIndex_++)->setPalette(activeLabelPalette);
    }
    else
    {
        oneByOneIndex_ = 0;
        return true;
    }

    return false;
}
Esempio n. 9
0
/** Returns a pointer to a new validator QLabel. The code is copied from
*  AlgorithmDialog.cpp and wont know if the validator label changes there
*  @param parent :: a pointer to an object that will look after it deleting it
*/
QLabel *UserSubWindow::newValidator(QWidget *parent) {
  QLabel *validLbl = new QLabel("*", parent);
  QPalette pal = validLbl->palette();
  pal.setColor(QPalette::WindowText, Qt::darkRed);
  validLbl->setPalette(pal);
  return validLbl;
}
FlashableWidget::FlashableWidget(int width, int height, QWidget *parent):
    QWidget(parent) ,vLabels_(), width_(width), height_(height),
    vActiveLabels_(), inactiveLabelPalette(), activeLabelPalette(),
    backgroundPalette(), currentHalve(0), selectedHalveWidth(0),
    selectedHalveHeight(0), firstHalveWidth(0), firstHalveHeight(0),
    secondHalveWidth(0), secondHalveHeight(0)
{
    grid = new QGridLayout;

    QFont f("Helvetica", 20);
    for(int row = 0; row < height_; ++row)
    {
        for(int column = 0; column < width_; ++column)
        {
            QLabel *label = new QLabel();
            label->setFont(f);
            label->setScaledContents(true);
            label->setFrameShape(QFrame::Box);
            label->setLineWidth(3);
            label->setAlignment(Qt::AlignCenter);
            label->setPalette(inactiveLabelPalette);
            label->setAutoFillBackground(true);
            grid->addWidget(label, row, column);
            vLabels_.push_back(label);
        }
    }

    setLayout(grid);

    oneByOneIndex_ = 0;
}
Esempio n. 11
0
void OBSPropertiesView::AddColor(obs_property_t *prop, QFormLayout *layout,
		QLabel *&label)
{
	QPushButton *button     = new QPushButton;
	QLabel      *colorLabel = new QLabel;
	const char  *name       = obs_property_name(prop);
	long long   val         = obs_data_get_int(settings, name);
	QColor      color       = color_from_int(val);

	button->setText(QTStr("Basic.PropertiesWindow.SelectColor"));

	colorLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
	colorLabel->setText(color.name(QColor::HexArgb));
	colorLabel->setPalette(QPalette(color));
	colorLabel->setAutoFillBackground(true);
	colorLabel->setAlignment(Qt::AlignCenter);

	QHBoxLayout *subLayout = new QHBoxLayout;
	subLayout->setContentsMargins(0, 0, 0, 0);

	subLayout->addWidget(colorLabel);
	subLayout->addWidget(button);

	WidgetInfo *info = new WidgetInfo(this, prop, colorLabel);
	connect(button, SIGNAL(clicked()), info, SLOT(ControlChanged()));
	children.emplace_back(info);

	label = new QLabel(QT_UTF8(obs_property_description(prop)));
	layout->addRow(label, subLayout);
}
Esempio n. 12
0
void Wizard::setupPage1()
{
    page1 = new QHBox( this );
    page1->setSpacing(8);

    QLabel *info = new QLabel( page1 );
    info->setPalette( yellow );
    info->setText( "Enter your personal\n"
                   "key here.\n\n"
                   "Your personal key\n"
                   "consists of 4 digits" );
    info->setIndent( 8 );
    info->setMaximumWidth( info->sizeHint().width() );

    QVBox *page = new QVBox( page1 );

    QHBox *row1 = new QHBox( page );

    (void)new QLabel( "Key:", row1 );

    key = new QLineEdit( row1 );
    key->setMaxLength( 4 );
    key->setValidator( new QIntValidator( 9999, 0, key ) );

    connect( key, SIGNAL( textChanged( const QString & ) ), this, SLOT( keyChanged( const QString & ) ) );

    addPage( page1, "Personal Key" );

    setNextEnabled( page1, FALSE );
    setHelpEnabled( page1, FALSE );
}
/**
 * Shows a context menu for the block widget. Launched with a right click.
 */
void QG_BlockWidget::contextMenuEvent(QContextMenuEvent *e) {

    QMenu* contextMenu = new QMenu(this);
    QLabel* caption = new QLabel(tr("Block Menu"), this);
    QPalette palette;
    palette.setColor(caption->backgroundRole(), RS_Color(0,0,0));
    palette.setColor(caption->foregroundRole(), RS_Color(255,255,255));
    caption->setPalette(palette);
    caption->setAlignment( Qt::AlignCenter );
    contextMenu->addAction( tr("&Defreeze all Blocks"), actionHandler,
                             SLOT(slotBlocksDefreezeAll()), 0);
    contextMenu->addAction( tr("&Freeze all Blocks"), actionHandler,
                             SLOT(slotBlocksFreezeAll()), 0);
    contextMenu->addAction( tr("&Add Block"), actionHandler,
                             SLOT(slotBlocksAdd()), 0);
    contextMenu->addAction( tr("&Remove Block"), actionHandler,
                             SLOT(slotBlocksRemove()), 0);
    contextMenu->addAction( tr("&Rename Block"), actionHandler,
                             SLOT(slotBlocksAttributes()), 0);
    contextMenu->addAction( tr("&Edit Block"), actionHandler,
                             SLOT(slotBlocksEdit()), 0);
    contextMenu->addAction( tr("&Insert Block"), actionHandler,
                             SLOT(slotBlocksInsert()), 0);
    contextMenu->addAction( tr("&Toggle Visibility"), actionHandler,
                             SLOT(slotBlocksToggleView()), 0);
    contextMenu->addAction( tr("&Create New Block"), actionHandler,
                             SLOT(slotBlocksCreate()), 0);
    contextMenu->exec(QCursor::pos());
    delete contextMenu;

    e->accept();
}
Esempio n. 14
0
void PlotScene::displayLabels(const QPointF& mousePos, const QPointF& scenePos)
{
    QPalette palette;
    PlotCurve* currentCurve = NULL;

    for (int i(0); i < this->curves.count(); i++)
    {
        currentCurve = this->curves.at(i);

        /* Get the CoordinateItem which abscisse is the nearest
         * to the mouse position abscisse */
        CoordinateItem* itemAtMousePos =
                currentCurve->nearestCoordinateitemsOfX(scenePos.x());

        if (itemAtMousePos == NULL) continue;

        // Get the label associate to the curve
        QLabel* curveLabel = this->curveLabels.at(i);
        if (curveLabel == NULL) continue;

        // Change the text color of the label associate to the curve
        palette.setColor(QPalette::WindowText, currentCurve->getPen().color());
        curveLabel->setPalette(palette);

        // Change the text of the label associate to the curve
        curveLabel->setText(QString("%1, %2").arg(
                                itemAtMousePos->x(), 6, 'f', 2).arg(
                                itemAtMousePos->y(), 6, 'f', 2));
        curveLabel->adjustSize();

        // Move the label
        curveLabel->move(mousePos.x(), mousePos.y() - (i * 12));
    }
}
Esempio n. 15
0
void MainWindow::refreshData()
{
  MultimeterAdapter::ReadingsList readings = adapter->getCurrentReadings();

  QList<QLabel *> labels = ui->currentReadings->findChildren<QLabel*>("reading");

  while(readings.count() > labels.count())
  {
    QLabel *label = new QLabel();
    label->setObjectName("reading");
    ui->currentReadings->layout()->addWidget(label);
    labels.append(label);
  }

  while(readings.count() < labels.count())
  {
    delete labels.takeLast();
  }

  for (int i = 0; i < labels.count(); i++)
  {
      QLabel* label = labels.at(i);

      label->setText(QString("%1 %2").arg(readings.at(i).second,5,'f',4).arg(SampleSeries::toString(readings.at(i).first)));

      QPalette palette;

      palette.setColor(QPalette::WindowText, getColor(readings.at(i).first));
      label->setPalette(palette);
  }

  ui->plot->replot();
}
Esempio n. 16
0
ScriptTerminatorWidget::ScriptTerminatorWidget( const QString &message )
: PopupWidget( 0 )
{
    setFrameStyle( QFrame::StyledPanel | QFrame::Raised );

    setContentsMargins( 4, 4, 4, 4 );

    setMinimumWidth( 26 );
    setMinimumHeight( 26 );
    setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );

    QPalette p = QToolTip::palette();
    setPalette( p );

    QLabel *alabel = new QLabel( message, this );
    alabel->setWordWrap( true );
    alabel->setTextFormat( Qt::RichText );
    alabel->setTextInteractionFlags( Qt::TextBrowserInteraction );
    alabel->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
    alabel->setPalette( p );

    KPushButton *button = new KPushButton( i18n( "Terminate" ), this );
    button->setPalette(p);;
    connect( button, SIGNAL(clicked()), SIGNAL(terminate()) );
    button = new KPushButton( KStandardGuiItem::close(), this );
    button->setPalette(p);
    connect( button, SIGNAL(clicked()), SLOT(hide()) );

    reposition();
}
void FlashableWidget::labelOn(int row, int column)
{
    int index = column + row*width_;
    QLabel* label = vLabels_.at(index);
    label->setPalette(activeLabelPalette);
    vActiveLabels_.push_back(label);
}
Esempio n. 18
0
bool WidgetInfo::ColorChanged(const char *setting)
{
	const char *desc = obs_property_description(property);
	long long  val   = obs_data_get_int(view->settings, setting);
	QColor     color = color_from_int(val);

	QColorDialog::ColorDialogOptions options =
		QColorDialog::ShowAlphaChannel;

	/* The native dialog on OSX has all kinds of problems, like closing
	 * other open QDialogs on exit, and
	 * https://bugreports.qt-project.org/browse/QTBUG-34532
	 */
#ifdef __APPLE__
	options |= QColorDialog::DontUseNativeDialog;
#endif

	color = QColorDialog::getColor(color, view, QT_UTF8(desc), options);

	if (!color.isValid())
		return false;

	QLabel *label = static_cast<QLabel*>(widget);
	label->setText(color.name(QColor::HexArgb));
	label->setPalette(QPalette(color));

	obs_data_set_int(view->settings, setting, color_to_int(color));

	return true;
}
Esempio n. 19
0
void Wizard::setupPage3()
{
    page3 = new QHBox( this );
    page3->setSpacing(8);

    QLabel *info = new QLabel( page3 );
    info->setPalette( yellow );
    info->setText( "\n"
                   "  Look here to see of  \n"
                   "  the data you entered  \n"
                   "  is correct. To confirm,  \n"
                   "  press the [Finish] button  \n"
                   "  else go back to correct  \n"
                   "  mistakes." );
    info->setIndent(8);
    info->setAlignment( AlignTop|AlignLeft );
    info->setMaximumWidth( info->sizeHint().width() );

    QVBox *page = new QVBox( page3 );

    QHBox *row1 = new QHBox( page );
    QHBox *row2 = new QHBox( page );
    QHBox *row3 = new QHBox( page );
    QHBox *row4 = new QHBox( page );
    QHBox *row5 = new QHBox( page );
    QHBox *row6 = new QHBox( page );

    QLabel *label1 = new QLabel( " Personal Key: ", row1 );
    label1->setAlignment( Qt::AlignVCenter );
    QLabel *label2 = new QLabel( " First Name: ", row2 );
    label2->setAlignment( Qt::AlignVCenter );
    QLabel *label3 = new QLabel( " Last Name: ", row3 );
    label3->setAlignment( Qt::AlignVCenter );
    QLabel *label4 = new QLabel( " Address: ", row4 );
    label4->setAlignment( Qt::AlignVCenter );
    QLabel *label5 = new QLabel( " Phone Number: ", row5 );
    label5->setAlignment( Qt::AlignVCenter );
    QLabel *label6 = new QLabel( " E-Mail: ", row6 );
    label6->setAlignment( Qt::AlignVCenter );

    label1->setMinimumWidth( label1->sizeHint().width() );
    label2->setMinimumWidth( label1->sizeHint().width() );
    label3->setMinimumWidth( label1->sizeHint().width() );
    label4->setMinimumWidth( label1->sizeHint().width() );
    label5->setMinimumWidth( label1->sizeHint().width() );
    label6->setMinimumWidth( label1->sizeHint().width() );

    lKey = new QLabel( row1 );
    lFirstName = new QLabel( row2 );
    lLastName = new QLabel( row3 );
    lAddress = new QLabel( row4 );
    lPhone = new QLabel( row5 );
    lEmail = new QLabel( row6 );

    addPage( page3, "Finish" );

    setFinish( page3, TRUE );
    setHelpEnabled( page3, FALSE );
}
Esempio n. 20
0
static QLabel* createLabel()
{
    QLabel *label = new QLabel;
    QPalette palette = label->palette();
    palette.setBrush(QPalette::Window, QBrush(Qt::white));
    label->setPalette(palette);
    return label;
}
Esempio n. 21
0
void ray_options::set_color(qint32 red, qint32 green, qint32 blue)
{
	QLabel *l = ui->color_preview;
	QColor col(red, green, blue);
	QPalette pal = l->palette();
	pal.setColor(l->backgroundRole(), col);
	l->setPalette(pal);
	r->set_color(col);
	backgroung->update();
}
Esempio n. 22
0
void Wizard::setupPage2()
{
    page2 = new QHBox( this );
    page2->setSpacing(8);

    QLabel *info = new QLabel( page2 );
    info->setPalette( yellow );
    info->setText( "\n"
                   "  Enter your personal  \n"
                   "  data here.  \n\n"
                   "  The required fields are  \n"
                   "  First Name, Last Name \n"
                   "  and E-Mail.  \n" );
    info->setIndent(8);
    info->setMaximumWidth( info->sizeHint().width() );

    QVBox *page = new QVBox( page2 );

    QHBox *row1 = new QHBox( page );
    QHBox *row2 = new QHBox( page );
    QHBox *row3 = new QHBox( page );
    QHBox *row4 = new QHBox( page );
    QHBox *row5 = new QHBox( page );

    QLabel *label1 = new QLabel( " First Name: ", row1 );
    label1->setAlignment( Qt::AlignVCenter );
    QLabel *label2 = new QLabel( " Last Name: ", row2 );
    label2->setAlignment( Qt::AlignVCenter );
    QLabel *label3 = new QLabel( " Address: ", row3 );
    label3->setAlignment( Qt::AlignVCenter );
    QLabel *label4 = new QLabel( " Phone Number: ", row4 );
    label4->setAlignment( Qt::AlignVCenter );
    QLabel *label5 = new QLabel( " E-Mail: ", row5 );
    label5->setAlignment( Qt::AlignVCenter );

    label1->setMinimumWidth( label4->sizeHint().width() );
    label2->setMinimumWidth( label4->sizeHint().width() );
    label3->setMinimumWidth( label4->sizeHint().width() );
    label4->setMinimumWidth( label4->sizeHint().width() );
    label5->setMinimumWidth( label4->sizeHint().width() );

    firstName = new QLineEdit( row1 );
    lastName = new QLineEdit( row2 );
    address = new QLineEdit( row3 );
    phone = new QLineEdit( row4 );
    email = new QLineEdit( row5 );

    connect( firstName, SIGNAL( textChanged( const QString & ) ), this, SLOT( dataChanged( const QString & ) ) );
    connect( lastName, SIGNAL( textChanged( const QString & ) ), this, SLOT( dataChanged( const QString & ) ) );
    connect( email, SIGNAL( textChanged( const QString & ) ), this, SLOT( dataChanged( const QString & ) ) );

    addPage( page2, "Personal Data" );

    setHelpEnabled( page2, FALSE );
}
Esempio n. 23
0
QWidget* AutoImportWindow::setupInputFolderContainer() {
    GroupContainer* container = new GroupContainer();
    container->setTitle("Import Folder");

    QFormLayout* layout = new QFormLayout;
    layout->setHorizontalSpacing(10);
    layout->setVerticalSpacing(0);
    layout->setRowWrapPolicy(QFormLayout::DontWrapRows);
    layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    layout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
    layout->setLabelAlignment(Qt::AlignLeft);

    BrowserWidget* filesDirBrowser_ = new BrowserWidget(BrowserWidget::BrowseType::DIRECTORY);
    ParametersConfiguration* conf  = projectData.projectParameterData();
    QString importImagesPath = conf->getValue("import_dir");
    filesDirBrowser_->setPath(importImagesPath);
    setupWatcherPaths();
    connect(filesDirBrowser_, &BrowserWidget::pathChanged, [ = ] (const QString & value){
        conf->set("import_dir", value);
        setupWatcherPaths();
        analyzeImport();
    });
    layout->addRow(filesDirBrowser_);

    QLabel* introLabel = new QLabel(introText());
    introLabel->setWordWrap(true);
    QPalette pal = introLabel->palette();
    pal.setColor(QPalette::WindowText, Qt::darkGray);
    introLabel->setPalette(pal);
    layout->addRow(introLabel);

    QCheckBox* restartCheck = new QCheckBox("Import new images in the import folder on start");
    restartCheck->setChecked(ProjectPreferences().importRestartCheck());
    connect(restartCheck, &QCheckBox::toggled, [ = ] (bool check){
        ProjectPreferences().setImportRestartCheck(check);
    });
    layout->addRow(restartCheck);

    
    layout->addRow(continuous);
    
    deleteCheck = new QCheckBox("DELETE the original images in import folder after importing them");
    deleteCheck->setChecked(ProjectPreferences().importDeleteCheck());
    deleteLabel_->setVisible(deleteCheck->isChecked());
    connect(deleteCheck, &QCheckBox::toggled, [ = ] (bool check){
        ProjectPreferences().setImportDeleteCheck(check);
        deleteLabel_->setVisible(check);
    });
    layout->addRow(deleteCheck);
    
    container->setContainerLayout(layout);

    return container;
}
Esempio n. 24
0
void        CreateVmlist::VmFactory()
{      
    vmslist.clear();
    labels.clear();
    QPalette p;
    p.setColor(QPalette::WindowText,Qt::white);
    int  m = 0;
    for(int i=0;i < nums_vm;i++,m++)
    {
        //QPushButton  *btton = new  QPushButton(QIcon("./images/a_detailed.png"),Vmgs[i].at(0)+"\nv"+Vmgs[i].at(1)/*+"\n"+Vmgs[i].at(2)*/,this);
        QPushButton  *btton = new  QPushButton(this);
        QLabel      *label  = new   QLabel(this);
        label->setStyleSheet("font-size:14px");
        btton->setFlat(true);
        btton->setFocusPolicy(Qt::NoFocus);
        setButtonBackImage(btton,"./images/a_detailed.png",60,60);
        if((Vmgs[i].at(0)).length() > 13)
        {
            QString  name = Vmgs[i].at(0);
            QString  name_0 = name.mid(0,13),name_1=name.mid(13,name.length()-13),name_2="";
            //if(name_1.length()>8)
            //    {name_2 = name_1.mid(8,name_1.length()-8);
            //    name_1 = name_1.mid(0,8);
            //    }
            //if(name_2.length() > 0)
            //label->setText(name_0+"\n  "+name_1+"\n    "+name_2+"\n\nVDI_"+Vmgs[i].at(1));
            //else
            label->setText(name_0+"\n "+name_1+"\n\nVDI_"+Vmgs[i].at(1));
        }
        else
        label->setText(Vmgs[i].at(0)+"\n\nVDI_"+Vmgs[i].at(1));
        label->setPalette(p);

        btngp->addButton(btton,i);
        vmslist.push_back(btton);
        labels.push_back(label);
        if(i%6 == 0)
        {
            m = 0;
        }
        /***********more than  6  ************/
        if(nums_vm >= 6)
        {
        btton->setGeometry(x()+130*m+lskey,y()+170*(i/6),60,60);
        label->setGeometry(x()+130*m+lskey,y()+60+170*(i/6),120,60);
        }
        else
        {
        btton->setGeometry(x()+130*i+lskey,y(),60,60);
        label->setGeometry(x()+130*i+lskey,y()+60,120,60);
        }
    }
    repaint();
}
Esempio n. 25
0
void SessionAnalysisWidget::setupColors()
{
    for (int i = 0; i < ui.gridLayout->columnCount(); i += 2)
    {
        QLabel *lab = (QLabel*)ui.gridLayout->itemAtPosition(0, i)->widget();

        QPalette palette = lab->palette();
        palette.setColor(QPalette::Window, ColorsManager::getInstance().getDriverColors()[i]);
        lab->setPalette(palette);

        lab = (QLabel*)ui.gridLayout->itemAtPosition(1, i)->widget();

        palette = lab->palette();
        palette.setColor(QPalette::Window, ColorsManager::getInstance().getDriverColors()[i+1]);
        lab->setPalette(palette);
    }
    setupIcons(ColorsManager::getInstance().getDriverColors());

    update();
}
Esempio n. 26
0
LongMessageWidget::LongMessageWidget( QWidget *anchor, const QString &message,
                                     Amarok::Logger::MessageType type )
        : PopupWidget( anchor )
        , m_counter( 0 )
        , m_timeout( 6000 )
{
    DEBUG_BLOCK
    Q_UNUSED( type )

    setFrameStyle( QFrame::StyledPanel | QFrame::Raised );

    setContentsMargins( 4, 4, 4, 4 );

    setMinimumWidth( 26 );
    setMinimumHeight( 26 );
    setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );

    QPalette p = QToolTip::palette();
    setPalette( p );

    KHBox *hbox = new KHBox( this );
    layout()->addWidget( hbox );

    hbox->setSpacing( 12 );

    m_countdownFrame = new CountdownFrame( hbox );
    m_countdownFrame->setObjectName( "counterVisual" );
    m_countdownFrame->setFixedWidth( fontMetrics().width( "X" ) );
    m_countdownFrame->setFrameStyle( QFrame::Plain | QFrame::Box );
    QPalette pal;
    pal.setColor( m_countdownFrame->foregroundRole(), p.dark().color() );
    m_countdownFrame->setPalette( pal );

    QLabel *alabel = new QLabel( message, hbox );
    alabel->setWordWrap( true );
    alabel->setOpenExternalLinks( true );
    alabel->setObjectName( "label" );
    alabel->setTextFormat( Qt::RichText );
    alabel->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
    alabel->setPalette( p );

    hbox = new KHBox( this );
    layout()->addWidget( hbox );

    KPushButton *button = new KPushButton( KStandardGuiItem::close(), hbox );
    button->setObjectName( "closeButton" );
    connect( button, SIGNAL( clicked() ), SLOT( close() ) );

    reposition();

    show();
    m_timerId = startTimer( m_timeout / m_countdownFrame->height() );
}
void FlashableWidget::allOn()
{
    for (int i = 0; i < vLabels_.size(); ++i)
    {
        QLabel* label = vLabels_.at(i);
        if(!vActiveLabels_.contains(label))
        {
            label->setPalette(inactiveLabelPalette);
            vActiveLabels_.push_back(label);
        }
    }
}
Esempio n. 28
0
void DetailWindow::blankKeyLabel(){
  deleteKeyLabels();
  QLabel* dummyLabel = new QLabel();
  QPalette pal = dummyLabel->palette();
  pal.setColor(backgroundRole(), Qt::black);
  dummyLabel->setPalette(pal);
  dummyLabel->setAutoFillBackground(true);
  dummyLabel->setMinimumHeight(20);
  dummyLabel->setMaximumHeight(30);
  dummyLabel->setToolTip(wrapToolTip(tr("Drag an audio file onto the window.")));
  ui->horizontalLayout_keyLabels->addWidget(dummyLabel);
  keyLabels.push_back(dummyLabel);
}
Esempio n. 29
0
CalamaresWindow::CalamaresWindow( QWidget* parent )
    : QWidget( parent )
{
    // Hide close button
    setWindowFlags( Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint );

    setMinimumSize( 1010, 560 );
    QSize availableSize = qApp->desktop()->screenGeometry( this ).size();
    int w = qBound( 1010, CalamaresUtils::defaultFontHeight() * 60, availableSize.width() );
    int h = qBound( 560,  CalamaresUtils::defaultFontHeight() * 36, availableSize.height() );

    cDebug() << "Proposed window size:" << w << h;
    resize( w, h );

    QBoxLayout* mainLayout = new QHBoxLayout;
    setLayout( mainLayout );

    QWidget* sideBox = new QWidget( this );
    mainLayout->addWidget( sideBox );

    QBoxLayout* sideLayout = new QVBoxLayout;
    sideBox->setLayout( sideLayout );
    sideBox->setFixedWidth( qMax( 190, CalamaresUtils::defaultFontHeight() * 12 ) );
    sideBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

    QHBoxLayout* logoLayout = new QHBoxLayout;
    sideLayout->addLayout( logoLayout );
    logoLayout->addStretch();
    QLabel* logoLabel = new QLabel( "branding\ngoes\nhere", sideBox );
    {
        QPalette plt = sideBox->palette();
        sideBox->setAutoFillBackground( true );
        plt.setColor( sideBox->backgroundRole(), CalamaresStyle::SIDEBAR_BACKGROUND );
        plt.setColor( sideBox->foregroundRole(), CalamaresStyle::SIDEBAR_TEXT );
        sideBox->setPalette( plt );
        logoLabel->setPalette( plt );
    }
    logoLabel->setAlignment( Qt::AlignCenter );
    logoLabel->setFixedSize( 80, 80 );
    logoLayout->addWidget( logoLabel );
    logoLayout->addStretch();

    ProgressTreeView* tv = new ProgressTreeView( sideBox );
    sideLayout->addWidget( tv );
    CalamaresUtils::unmarginLayout( sideLayout );
    CalamaresUtils::unmarginLayout( mainLayout );

    Calamares::ViewManager* vm = new Calamares::ViewManager( this );

    mainLayout->addWidget( vm->centralWidget() );
}
Esempio n. 30
0
QLabel* UtilityIconPainting::buildLighterTextLabel(const QString& text, QWidget* parentWidget) {

    QLabel* textLabel = new QLabel(text, parentWidget);

    QPalette textLabelPalette = textLabel->palette();
    QColor fgcolor = KColorUtils::tint(textLabelPalette.color(QPalette::Disabled, QPalette::WindowText),
                                       textLabelPalette.color(QPalette::Active, QPalette::WindowText),
                                       0.6);

    textLabelPalette.setColor(QPalette::WindowText, fgcolor);

    textLabel->setPalette(textLabelPalette);

    return textLabel;
}