PropertyPanel::PropertyPanel( QWidget* parent, const char* name, WFlags fl )
	: PropertyPanelBase( parent, name, fl ),
	  component(0L),
	  port(0L)
{
	setTitleFont();
	setTitleColors();
	connect( kapp, SIGNAL( kdisplayFontChanged() ),
			 this, SLOT( setTitleFont() ));
	connect( kapp, SIGNAL( kdisplayPaletteChanged() ),
			 this, SLOT( setTitleColors() ));
	connect( portValueGroup, SIGNAL( clicked(int) ),
			 this, SLOT( pvModeChanged(int) ));
	connect( constantValueEdit, SIGNAL( returnPressed() ),
			 this, SLOT( writePortProperties() ));
	connect( constantValueComboBox, SIGNAL( activated(int) ),
			 this, SLOT( writePortProperties() ));
	connect( portCombo, SIGNAL( activated(int) ),
			 this, SLOT( comboPortSelected(int) ));
	connect( connectButton, SIGNAL( clicked() ),
			 this, SLOT( connectButtonClicked() ));

	constantValueComboBox->hide();
	setEnabled( false );
	tipLabel->hide();
}
Esempio n. 2
0
K3Wizard::K3Wizard( QWidget *parent, const char *name, bool modal, Qt::WFlags f )
            : Q3Wizard( parent, name, modal, f )
{
  bool useIcons = KGlobalSettings::showIconsOnPushButtons();

  if ( useIcons )
  {
    KGuiItem back = KStandardGuiItem::back( KStandardGuiItem::UseRTL );
    KGuiItem forward = KStandardGuiItem::forward( KStandardGuiItem::UseRTL );

    backButton()->setIcon( back.icon() );
    nextButton()->setIcon( forward.icon() );

    finishButton()->setIcon( KIcon( "dialog-ok-apply" ) );
    cancelButton()->setIcon( KIcon( "dialog-cancel" ) );
    helpButton()->setIcon( KIcon( "help-contents" ) );

    backButton()->setText( i18n( "&Back" ) );
    nextButton()->setText( i18nc( "Opposite to Back","&Next" ) );
  }

  QFont font = titleFont();
  font.setBold( true );
  setTitleFont( font );
}
Esempio n. 3
0
KWizard::KWizard( QWidget *parent, const char *name, bool modal, WFlags f )
            : QWizard( parent, name, modal, f )
{
  bool useIcons = KGlobalSettings::showIconsOnPushButtons();

  if ( useIcons )
  {
    KGuiItem back = KStdGuiItem::back( KStdGuiItem::UseRTL );
    KGuiItem forward = KStdGuiItem::forward( KStdGuiItem::UseRTL );

    backButton()->setIconSet( back.iconSet() );
    nextButton()->setIconSet( forward.iconSet() );

    finishButton()->setIconSet( SmallIconSet( "apply" ) );
    cancelButton()->setIconSet( SmallIconSet( "button_cancel" ) );
    helpButton()->setIconSet( SmallIconSet( "help" ) );

    backButton()->setText( i18n( "&Back" ) );
    nextButton()->setText( i18n( "Opposite to Back","&Next" ) );
  }

  QFont font = titleFont();
  font.setBold( true );
  setTitleFont( font );
}
Esempio n. 4
0
void GraphEditor::_btnTitleFont_clicked()
{
    bool valid;
    QFont fnt = QFontDialog::getFont(&valid, getTitleFont(), this);
    if(valid) {
        setTitleFont(fnt);
    }
}
Esempio n. 5
0
ElementTitle::ElementTitle(qreal x, qreal y, QString const &text)
	: mFocusIn(false), mReadOnly(true), mScalingX(false), mScalingY(false), mPoint(x, y), mBinding(""), mBackground(Qt::transparent)
{
	setTitleFont();
	setPos(x, y);
	setHtml(text);

}
Esempio n. 6
0
void
CQGroupBox::
setTitleScale(double scale)
{
  titleScale_ = scale;

  setTitleFont();

  update();
}
Esempio n. 7
0
void
CQGroupBox::
setTitleBold(bool bold)
{
  titleBold_ = bold;

  setTitleFont();

  update();
}
int
setFont(struct boxFonts *fonts)
{
  if (!setMenuFont(fonts->menuFont))
    return 1;
  if (!setInputFont(fonts->inputFont))
    return 1;    
  if (!setButtonFont(fonts->buttonFont))
    return 1;    
  if (!setTitleFont(fonts->titleFont))
    return 1;    
  if (!setTextFont(fonts->textFont))
    return 1;
  return 0;        
}
Esempio n. 9
0
void
CQGroupBox::
init()
{
  setObjectName("groupBox");

  setTitleFont();

  lineColor_ = palette().color(QPalette::Mid);

  //----

  //area_ = new CQGroupBoxArea;

  //area_->setParent(this);

  setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
}
Esempio n. 10
0
int Q3Wizard::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 10)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 10;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QFont*>(_v) = titleFont(); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setTitleFont(*reinterpret_cast< QFont*>(_v)); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 1;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Esempio n. 11
0
void PGE_QuestionBox::construct(QString _title, PGE_MenuBox::msgType _type,
                            PGE_Point pos, float _padding, QString texture)
{
    if(!texture.isEmpty())
        loadTexture(texture);

    updateTickValue();
    _page=0;
    running=false;
    _answer_id = -1;
    _pos=pos;
    _menu.setTextLenLimit(30, true);
    _menu.setItemsNumber(2);
    setTitleFont(ConfigManager::setup_menu_box.title_font_name);
    setTitleFontColor(ConfigManager::setup_menu_box.title_font_rgba);
    /****************Word wrap*********************/
    title = _title;
    FontManager::optimizeText(title, 27);
    title_size = FontManager::textSize(_title, fontID, 27);
    /****************Word wrap*end*****************/
    setPadding(_padding);
    setType(_type);
    updateSize();
}
Esempio n. 12
0
void
Style::drawGroupBox(const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
{
    ASSURE_OPTION(groupBox, GroupBox);
    OPT_ENABLED

    // Frame
    if (groupBox->subControls & QStyle::SC_GroupBoxFrame)
    {
        QStyleOptionFrameV2 frame;
        frame.QStyleOption::operator=(*groupBox);
        frame.features = groupBox->features;
        frame.lineWidth = groupBox->lineWidth;
        frame.midLineWidth = groupBox->midLineWidth;
        frame.rect = subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
        drawGroupBoxFrame(&frame, painter, widget);
    }

    // Title
    if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty())
    {
        QColor textColor = groupBox->textColor;
        QPalette::ColorRole role = QPalette::WindowText;
        // NOTICE, WORKAROUND: groupBox->textColor is black by def. and should be invalid - but it's not
        // so assuming everything is optimized for a black on white world, we assume the
        // CUSTOM groupBox->textColor to be only valid if it's != Qt::black
        // THIS IS A HACK!
        if (textColor.isValid() && textColor != Qt::black)
        {
            if (!isEnabled)
                textColor.setAlpha(48);
            painter->setPen(textColor);
            role = QPalette::NoRole;
        }
        setTitleFont(painter, groupBox->text, RECT.width());
        QStyleOptionGroupBox copy = *groupBox;
        copy.fontMetrics = QFontMetrics(painter->font());
        QRect textRect = subControlRect(CC_GroupBox, &copy, SC_GroupBoxLabel, widget);
        drawItemText(painter, textRect, BESPIN_MNEMONIC, groupBox->palette, isEnabled, groupBox->text, role);
        if (groupBox->features & QStyleOptionFrameV2::Flat)
        {
            Tile::PosFlags pf = Tile::Center;
            if (option->direction == Qt::LeftToRight)
            {
                textRect.setLeft(RECT.left());
                textRect.setRight(textRect.right() + (RECT.right()-textRect.right())/2);
                pf |= Tile::Right;
            }
            else
            {
                textRect.setRight(RECT.right());
                textRect.setLeft(textRect.left() - (textRect.left() - RECT.left())/2);
                pf |= Tile::Left;
            }
            shadows.line[0][Sunken].render(textRect, painter, pf, true);

//             const int x = textRect.right();
//             textRect.setRight(RECT.right()); textRect.setLeft(x);
//             shadows.line[0][Sunken].render(textRect, painter, Tile::Center | Tile::Right, true);
        }
        else if (config.groupBoxMode)
        {
            const int x = textRect.width()/8;
            textRect.adjust(x,0,-x,0);
            shadows.line[0][Sunken].render(textRect, painter, Tile::Full, true);
        }
    }

    // Checkbox
    // TODO: doesn't hover - yet.
    if (groupBox->subControls & SC_GroupBoxCheckBox)
    {
        QStyleOptionButton box;
        box.QStyleOption::operator=(*groupBox);
        box.rect = subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget);
//       box.state |= State_HasFocus; // focus to signal this to the user
        if (groupBox->activeSubControls & SC_GroupBoxCheckBox)
            box.state |= State_MouseOver;
        drawRadio(&box, painter, 0L);
    }
}
Esempio n. 13
0
ElementTitle::ElementTitle(qreal x, qreal y, QString const &binding, bool readOnly)
	: mFocusIn(false), mReadOnly(readOnly), mScalingX(false), mScalingY(false), mPoint(x, y), mBinding(binding), mBackground(Qt::transparent)
{
	setTitleFont();
	setPos(x, y);
}
Esempio n. 14
0
void PlotExporter::exportPlot(QwtPlot *plot, const QRectF &zoom)
{
  QSizeF guessedDimensions;
  ExportPlotToImageDialog::Parameters p = m_exportDlg->parameters();

  m_exportDlg->setAspectRatio(plot->size().width() / plot->size().height());

  while (m_exportDlg->exec() == QDialog::Accepted) {
    p = m_exportDlg->parameters();

    QString path;

    if (p.path.length() < 0) {
      QMessageBox::warning(nullptr, QObject::tr("Invalid input"), QObject::tr("Invalid path"));
      continue;
    }
    if (!m_supportedFormats.contains(p.format)) {
      QMessageBox::warning(nullptr, QObject::tr("Invalid input"), QObject::tr("Invalid output format"));
      continue;
    }

    if (p.path.endsWith("." + p.format))
      path = p.path;
    else
      path = p.path + "." + p.format;

    /* Create a temporary QwtPlot to use to write the chart to file */
    QwtPlot exPlot;
    QwtPlotZoomer exPlorZoomer(exPlot.canvas());
    exPlorZoomer.zoom(zoom);

    exPlot.setCanvasBackground(QBrush(Qt::white));
    exPlot.setTitle(p.title);
    exPlot.setAxisTitle(QwtPlot::xBottom, plot->axisTitle(QwtPlot::xBottom));
    exPlot.setAxisTitle(QwtPlot::xTop, plot->axisTitle(QwtPlot::xTop));
    exPlot.setAxisTitle(QwtPlot::yLeft, plot->axisTitle(QwtPlot::yLeft));
    exPlot.setAxisTitle(QwtPlot::yRight, plot->axisTitle(QwtPlot::yRight));
    QwtPlotItemList curves = plot->itemList();

    /* Attach all plots from the GUI plot to the temporary plot
     * Note that this will detach the plots from the GUI plot! */
    QList<qreal> curvePenWidths;
    for (QwtPlotItem *i : curves) {
      QwtPlotCurve *c = dynamic_cast<QwtPlotCurve *>(i);

      if (c != nullptr) {
        QPen p = c->pen();
        qreal w = p.widthF();
        qreal nw;

        curvePenWidths.push_back(w);

        nw = w - 1.0;
        if (nw < 0.0)
          nw = 0.0;

        p.setWidthF(nw);
        c->setPen(p);
      }

      i->attach(&exPlot);
    }

    /* Scale up from millimeters to centimeters*/
    QSizeF dimensionsMM(p.dimensions.width() * 10.0, p.dimensions.height() * 10.0);

    /* Store current properties of the plot as we need to change them for rendering */
    QFont xBottomFont = plot->axisWidget(QwtPlot::xBottom)->font();
    QFont xTopFont = plot->axisWidget(QwtPlot::xTop)->font();
    QFont yLeftFont = plot->axisWidget(QwtPlot::yLeft)->font();
    QFont yRightFont = plot->axisWidget(QwtPlot::yRight)->font();
    QFont xBottomTitleFont = plot->axisTitle(QwtPlot::xBottom).font();
    QFont xTopTitleFont = plot->axisTitle(QwtPlot::xTop).font();
    QFont yLeftTitleFont = plot->axisTitle(QwtPlot::yLeft).font();
    QFont yRightTitleFont = plot->axisTitle(QwtPlot::yRight).font();
    QFont titleFont = plot->title().font();
    const qreal xBottomPenWidth = plot->axisWidget(QwtPlot::xBottom)->scaleDraw()->penWidth() > 0 ? plot->axisWidget(QwtPlot::xBottom)->scaleDraw()->penWidth() : 1.0;
    const qreal xTopPenWidth = plot->axisWidget(QwtPlot::xTop)->scaleDraw()->penWidth() > 0 ? plot->axisWidget(QwtPlot::xTop)->scaleDraw()->penWidth() : 1.0;
    const qreal yLeftPenWidth = plot->axisWidget(QwtPlot::yLeft)->scaleDraw()->penWidth() > 0 ? plot->axisWidget(QwtPlot::yLeft)->scaleDraw()->penWidth() : 1.0;
    const qreal yRightPenWidth = plot->axisWidget(QwtPlot::yRight)->scaleDraw()->penWidth() > 0 ? plot->axisWidget(QwtPlot::yRight)->scaleDraw()->penWidth() : 1.0;

    /* Recalculate sizes by the DPI for every element that needs it */
    const qreal outputInPixels = (static_cast<qreal>(p.dimensions.width()) / 2.54) * p.dpi;
    const qreal scalingRatio = (static_cast<qreal>(qApp->desktop()->logicalDpiX()) / p.dpi) * (outputInPixels / plot->geometry().width());

    const qreal _xBottomPenWidth = floor((xBottomPenWidth * scalingRatio) + 0.45);
    const qreal _xTopPenWidth = floor((xTopPenWidth * scalingRatio) + 0.45);
    const qreal _yLeftPenWidth = floor((yLeftPenWidth * scalingRatio) + 0.45);
    const qreal _yRightPenWidth = floor((yRightPenWidth * scalingRatio) + 0.45);
    xBottomFont.setPointSizeF(p.axisNumbersFontSize * scalingRatio);
    xTopFont.setPointSizeF(p.axisNumbersFontSize * scalingRatio);
    yLeftFont.setPointSizeF(p.axisNumbersFontSize * scalingRatio);
    yRightFont.setPointSizeF(p.axisNumbersFontSize * scalingRatio);
    xBottomTitleFont.setPointSizeF(p.axisTitlesFontSize * scalingRatio);
    xTopTitleFont.setPointSizeF(p.axisTitlesFontSize * scalingRatio);
    yLeftTitleFont.setPointSizeF(p.axisTitlesFontSize * scalingRatio);
    yRightTitleFont.setPointSizeF(p.axisTitlesFontSize * scalingRatio);
    titleFont.setPointSizeF(p.chartTitleFontSize * scalingRatio);
    exPlot.axisWidget(QwtPlot::xBottom)->scaleDraw()->setPenWidth(_xBottomPenWidth);
    exPlot.axisWidget(QwtPlot::xTop)->scaleDraw()->setPenWidth(_xTopPenWidth);
    exPlot.axisWidget(QwtPlot::yLeft)->scaleDraw()->setPenWidth(_yLeftPenWidth);
    exPlot.axisWidget(QwtPlot::yRight)->scaleDraw()->setPenWidth(_yRightPenWidth);

    exPlot.setPalette(m_plotPalette);
    exPlot.axisWidget(QwtPlot::xBottom)->setPalette(m_plotPalette);
    exPlot.axisWidget(QwtPlot::xTop)->setPalette(m_plotPalette);
    exPlot.axisWidget(QwtPlot::yLeft)->setPalette(m_plotPalette);
    exPlot.axisWidget(QwtPlot::yRight)->setPalette(m_plotPalette);
    exPlot.axisWidget(QwtPlot::xBottom)->setFont(xBottomFont);
    exPlot.axisWidget(QwtPlot::xTop)->setFont(xTopFont);
    exPlot.axisWidget(QwtPlot::yLeft)->setFont(yLeftFont);
    exPlot.axisWidget(QwtPlot::yRight)->setFont(yRightFont);
    setAxisTitleFont(&exPlot, QwtPlot::xBottom, xBottomTitleFont);
    setAxisTitleFont(&exPlot, QwtPlot::xTop, xTopTitleFont);
    setAxisTitleFont(&exPlot, QwtPlot::yLeft, yLeftTitleFont);
    setAxisTitleFont(&exPlot, QwtPlot::yRight, yRightTitleFont);
    setTitleFont(&exPlot, titleFont);

    exPlot.replot();

    renderPlotToFile(&exPlot, path, p.format, dimensionsMM, p.dpi);

    /* Reattach the plots back to the GUI plot */
    for (QwtPlotItem *i : curves) {
      QwtPlotCurve *c = dynamic_cast<QwtPlotCurve *>(i);

      if (c != nullptr) {
        QPen p = c->pen();

        if (curvePenWidths.isEmpty())
          break;

        p.setWidthF(curvePenWidths.front());
        curvePenWidths.pop_front();

        c->setPen(p);
      }

      i->attach(plot);
    }

    break; /* Exit the while loop */
  }
}
Esempio n. 15
0
void Graph::setTitleFont(const QFont & fnt) { setTitleFont(&fnt); }