// Dynamically change font size of list of push button according to the
// size of the buttons.
void VirtualKeyboardMouseWidget::setButtonFontSizes()
{
    //int tempWidgetFontSize = 20;
    QList<VirtualKeyPushButton*> buttonList = this->findChildren<VirtualKeyPushButton*>();
    QListIterator<VirtualKeyPushButton*> iter(buttonList);
    while (iter.hasNext())
    {
        VirtualKeyPushButton *temp = iter.next();
        //widgetSizeMan = qMin(temp->calculateFontSize(), tempWidgetFontSize);
        QFont tempFont(temp->font());
        tempFont.setPointSize(temp->calculateFontSize());
        temp->setFont(tempFont);
        //temp->update();
    }

    /*iter.toFront();

    while (iter.hasNext())
    {
        VirtualKeyPushButton *temp = iter.next();
        QFont tempFont(temp->font());
        tempFont.setPointSize(widgetSizeMan);
        temp->setFont(tempFont);
    }
    */
}
void INDI_E::setupElementLabel()
{
    QPalette palette;

    label_w = new KSqueezedTextLabel(guiProp->getGroup()->getContainer());
    label_w->setMinimumWidth(ELEMENT_LABEL_WIDTH);
    label_w->setMaximumWidth(ELEMENT_LABEL_WIDTH);
    label_w->setFrameShape( KSqueezedTextLabel::Box );

    palette.setColor(label_w->backgroundRole(),  QColor( 224, 232, 238 ));
    label_w->setPalette(palette);
    label_w->setTextFormat( Qt::RichText );
    label_w->setAlignment( Qt::AlignCenter );
    label_w->setWordWrap(true);

    if (label.length() > MAX_LABEL_LENGTH)
    {
        QFont tempFont(  label_w->font() );
        tempFont.setPointSize( tempFont.pointSize() - MED_INDI_FONT );
        label_w->setFont( tempFont );
    }

    label_w->setText(label);

    EHBox->addWidget(label_w);
}
QMap<QString, QVariant> QgisAppStyleSheet::defaultOptions()
{
  QMap<QString, QVariant> opts;

  // the following default values, before insertion in opts, can be
  // configured using the platforms and window servers defined in the
  // constructor to set reasonable non-Qt defaults for the app stylesheet
  QgsSettings settings;
  // handle move from old QgsSettings group (/) to new (/qgis/stylesheet)
  // NOTE: don't delete old QgsSettings keys, in case user is also running older QGIS
  QVariant oldFontPointSize = settings.value( QStringLiteral( "fontPointSize" ) );
  QVariant oldFontFamily = settings.value( QStringLiteral( "fontFamily" ) );

  settings.beginGroup( QStringLiteral( "qgis/stylesheet" ) );

  int fontSize = mDefaultFont.pointSize();
  if ( mAndroidOS )
  {
    // TODO: find a better default fontsize maybe using DPI detection or so (from Marco Bernasocchi commit)
    fontSize = 8;
  }
  if ( oldFontPointSize.isValid() && !settings.value( QStringLiteral( "fontPointSize" ) ).isValid() )
  {
    fontSize = oldFontPointSize.toInt();
  }
  QgsDebugMsg( QStringLiteral( "fontPointSize: %1" ).arg( fontSize ) );
  opts.insert( QStringLiteral( "fontPointSize" ), settings.value( QStringLiteral( "fontPointSize" ), QVariant( fontSize ) ) );

  QString fontFamily = mDefaultFont.family();
  if ( oldFontFamily.isValid() && !settings.value( QStringLiteral( "fontFamily" ) ).isValid() )
  {
    fontFamily = oldFontFamily.toString();
  }
  fontFamily = settings.value( QStringLiteral( "fontFamily" ), QVariant( fontFamily ) ).toString();
  // make sure family exists on system
  if ( fontFamily != mDefaultFont.family() )
  {
    QFont tempFont( fontFamily );
    if ( tempFont.family() != fontFamily )
    {
      // missing from system, drop back to default
      fontFamily = mDefaultFont.family();
    }
  }
  QgsDebugMsg( QStringLiteral( "fontFamily: %1" ).arg( fontFamily ) );
  opts.insert( QStringLiteral( "fontFamily" ), QVariant( fontFamily ) );

  bool gbxCustom = ( mMacStyle );
  opts.insert( QStringLiteral( "groupBoxCustom" ), settings.value( QStringLiteral( "groupBoxCustom" ), QVariant( gbxCustom ) ) );

  opts.insert( QStringLiteral( "toolbarSpacing" ), settings.value( QStringLiteral( "toolbarSpacing" ), QString() ) );

  settings.endGroup(); // "qgis/stylesheet"

  opts.insert( QStringLiteral( "iconSize" ), settings.value( QStringLiteral( "/qgis/iconSize" ), QGIS_ICON_SIZE ) );

  return opts;
}
void CommercialGraphic::checkAwayFont()
{
    int fontPointSize = away->font().pointSize();
    int subtraction = 1;
    QFontMetrics fontSize(away->font());
    while (fontSize.width(away->toPlainText()) > NAME_WIDTH - 5) {
        QFont tempFont("Arial", fontPointSize - subtraction, QFont::Bold);
        subtraction++;
        away->setFont(tempFont);
        QFontMetrics temp(away->font());
        fontSize = temp;
    }
}
Exemple #5
0
//------------------------------------------------------------------------------
AboutPage::AboutPage()
    : Component()
{
    const double m(getSystemScaling());

    String tempstr;
    Font tempFont(26.0f*m);
    tempFont.setHeight(28.0f*m);

    tempstr = T("MOD Live-ISO");
    addAndMakeVisible(title = new Label(T("title"), tempstr));
    title->setFont(tempFont);
    title->setColour(Label::textColourId, textColour);

    tempFont.setBold(true);
    tempFont.setHeight(14.0f*m);

    tempstr = T("Author:");
    addAndMakeVisible(authorLabel = new Label(T("authorLabel"), tempstr));
    authorLabel->setFont(tempFont);
    authorLabel->setColour(Label::textColourId, textColour);
    authorLabel->setJustificationType(Justification::centredLeft);

    tempstr = T("Website:");
    addAndMakeVisible(websiteLabel = new Label(T("websiteLabel"), tempstr));
    websiteLabel->setFont(tempFont);
    websiteLabel->setColour(Label::textColourId, textColour);
    websiteLabel->setJustificationType(Justification::centredLeft);

    tempstr = T("Credits:");
    addAndMakeVisible(creditsLabel = new Label(T("creditsLabel"), tempstr));
    creditsLabel->setFont(tempFont);
    creditsLabel->setColour(Label::textColourId, textColour);
    creditsLabel->setJustificationType(Justification::centredLeft);

    tempstr = T("About:");
    addAndMakeVisible(descriptionLabel = new Label(T("descriptionLabel"), tempstr));
    descriptionLabel->setFont(tempFont);
    descriptionLabel->setColour(Label::textColourId, textColour);
    descriptionLabel->setJustificationType(Justification::topLeft);

    tempstr = T("License:");
    addAndMakeVisible(licenseLabel = new Label(T("licenseLabel"), tempstr));
    licenseLabel->setFont(tempFont);
    licenseLabel->setColour(Label::textColourId, textColour);
    licenseLabel->setJustificationType(Justification::centredLeft);

    tempstr = T("falkTX");
    addAndMakeVisible(author = new Label(T("author"), tempstr));
    tempFont.setBold(false);
    author->setFont(tempFont);
    author->setColour(Label::textColourId, textColour);
    author->setJustificationType(Justification::centredLeft);

    tempstr = T("https://github.com/moddevices/mod-iso");
    addAndMakeVisible(website = new Label(T("website"), tempstr));
    website->setFont(tempFont);
    website->setColour(Label::textColourId, textColour);
    website->setJustificationType(Justification::centredLeft);

    tempstr  = T("Niall Moody, for making Twindy. See: http://www.niallmoody.com/twindy/\n");
    tempstr << T("Julian Storer, for making JUCE. See: http://www.rawmaterialsoftware.com/juce/");
    addAndMakeVisible(credits = new Label(T("credits"), tempstr));
    credits->setFont(tempFont);
    credits->setColour(Label::textColourId, textColour);
    credits->setJustificationType(Justification::topLeft);

    tempstr  = T("Publications, products, content or services referenced herein or on the website are the exclusive");
    tempstr << T(" trademarks or servicemarks of MOD.\nOther product and company names mentioned in the site may be");
    tempstr << T(" the trademarks of their respective owners.\nAll software is available under the GPL license, see");
    tempstr << T(" https://www.gnu.org/licenses/gpl-2.0.html for details.");
    addAndMakeVisible(description = new Label(T("description"), tempstr));
    description->setFont(tempFont);
    description->setColour(Label::textColourId, textColour);
    description->setJustificationType(Justification::topLeft);

    tempstr = T("GPL - see the COPYING file for details.");
    addAndMakeVisible(license = new Label(T("license"), tempstr));
    license->setFont(tempFont);
    license->setColour(Label::textColourId, textColour);
    license->setJustificationType(Justification::centredLeft);
}