コード例 #1
0
QRectF ArtisticTextShape::nullBoundBox() const
{
    QFontMetrics metrics(defaultFont());
    QPointF tl(0.0, -metrics.ascent());
    QPointF br(metrics.averageCharWidth(), metrics.descent());
    return QRectF(tl, br);
}
コード例 #2
0
MainWindow::MainWindow()
{
    theEditor = this;

    mdiArea = new QMdiArea;
    setCentralWidget(mdiArea);
    connect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)),
            this, SLOT(updateActions()));

    createActions();
    createMenus();
    createToolBars();

    inputAction->setEnabled(true);
    output1Action->setEnabled(false);
    output2Action->setEnabled(false);

    //set font toolbar
    QFont defaultFont("Courier");
    comboFont->setCurrentFont(defaultFont);
    comboSize->setCurrentIndex(3); //= 9 pt.

    createStatusBar();
    updateActions();

    setWindowIcon(QPixmap(":/images/icon.png"));
    setWindowTitle(tr("Pollen Compatibility Calculator"));
    QTimer::singleShot(0, this, SLOT(loadFiles()));
}
コード例 #3
0
ファイル: options.cpp プロジェクト: serghei/kde3-kdenetwork
QFont GlobalData::headingsFont()
{
  if(useCustomFonts)
    return f_onts[Fheadings];
  else
    return defaultFont(Fheadings);
}
コード例 #4
0
ファイル: options.cpp プロジェクト: serghei/kde3-kdenetwork
QFont GlobalData::textFont()
{
  if(useCustomFonts)
    return f_onts[Ftext];
  else
    return defaultFont(Ftext);
}
コード例 #5
0
int QTextDocument::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 14)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 14;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isUndoRedoEnabled(); break;
        case 1: *reinterpret_cast< bool*>(_v) = isModified(); break;
        case 2: *reinterpret_cast< QSizeF*>(_v) = pageSize(); break;
        case 3: *reinterpret_cast< QFont*>(_v) = defaultFont(); break;
        case 4: *reinterpret_cast< bool*>(_v) = useDesignMetrics(); break;
        case 5: *reinterpret_cast< QSizeF*>(_v) = size(); break;
        case 6: *reinterpret_cast< qreal*>(_v) = textWidth(); break;
        case 7: *reinterpret_cast< int*>(_v) = blockCount(); break;
        case 8: *reinterpret_cast< qreal*>(_v) = indentWidth(); break;
        case 9: *reinterpret_cast< QString*>(_v) = defaultStyleSheet(); break;
        case 10: *reinterpret_cast< int*>(_v) = maximumBlockCount(); break;
        case 11: *reinterpret_cast< qreal*>(_v) = documentMargin(); break;
        }
        _id -= 12;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setUndoRedoEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 1: setModified(*reinterpret_cast< bool*>(_v)); break;
        case 2: setPageSize(*reinterpret_cast< QSizeF*>(_v)); break;
        case 3: setDefaultFont(*reinterpret_cast< QFont*>(_v)); break;
        case 4: setUseDesignMetrics(*reinterpret_cast< bool*>(_v)); break;
        case 6: setTextWidth(*reinterpret_cast< qreal*>(_v)); break;
        case 8: setIndentWidth(*reinterpret_cast< qreal*>(_v)); break;
        case 9: setDefaultStyleSheet(*reinterpret_cast< QString*>(_v)); break;
        case 10: setMaximumBlockCount(*reinterpret_cast< int*>(_v)); break;
        case 11: setDocumentMargin(*reinterpret_cast< qreal*>(_v)); break;
        }
        _id -= 12;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 12;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #6
0
ファイル: OutputWidget.cpp プロジェクト: Zeex/qawno
OutputWidget::OutputWidget(QWidget *parent):
    QPlainTextEdit(parent)
{
    QSettings settings;
    QFont font = defaultFont();
    font.fromString(settings.value("OutputFont", font).toString());
    setFont(font);
}
コード例 #7
0
void tst_QXYSeries::pointLabelsFont()
{
    QFont defaultFont(m_series->pointLabelsFont());
    QSignalSpy labelsFontSpy(m_series, SIGNAL(pointLabelsFontChanged(QFont)));

    QFont font("Times", 10);
    m_series->setPointLabelsFont(font);
    TRY_COMPARE(labelsFontSpy.count(), 1);
    QList<QVariant> arguments = labelsFontSpy.takeFirst();
    QVERIFY(arguments.at(0).value<QFont>() == font);

    m_series->setPointLabelsFont(defaultFont);
    TRY_COMPARE(labelsFontSpy.count(), 1);
    arguments = labelsFontSpy.takeFirst();
    QVERIFY(arguments.at(0).value<QFont>() == defaultFont);

}
コード例 #8
0
ファイル: properties.cpp プロジェクト: ashang/qterminal-2
void Properties::loadSettings()
{
    QSettings settings(filename, QSettings::IniFormat);

    guiStyle = settings.value("guiStyle", QString()).toString();
    if (!guiStyle.isNull())
        QApplication::setStyle(guiStyle);

    colorScheme = settings.value("colorScheme", "Linux").toString();

    highlightCurrentTerminal = settings.value("highlightCurrentTerminal", true).toBool();

    font = qvariant_cast<QFont>(settings.value("font", defaultFont()));

    settings.beginGroup("Shortcuts");
    QStringList keys = settings.childKeys();
    foreach( QString key, keys )
    {
        QKeySequence sequence = QKeySequence( settings.value( key ).toString() );
        if( Properties::Instance()->actions.contains( key ) )
            Properties::Instance()->actions[ key ]->setShortcut( sequence );
    }
コード例 #9
0
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    if ( !Layer::init() )
    {
        return false;
    }
    
    FileUtils::getInstance()->addSearchPath("fonts");
    
    Size size = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    std::string defaultFont("arial.ttf");
    int defaultFontSize = 32;
    
    auto eventItem = MenuItemLabel::create(Label::createWithTTF("Log Event", defaultFont, defaultFontSize),
                                           CC_CALLBACK_1(HelloWorld::onEvent, this));
    
    auto menu = Menu::create(eventItem, NULL);
    menu->setPosition(Vec2(size.width/2, size.height/2));
    addChild(menu);
    
    auto closeItem = MenuItemImage::create(
                                           "CloseNormal.png",
                                           "CloseSelected.png",
                                           CC_CALLBACK_1(HelloWorld::menuCloseCallback, this));
    
	closeItem->setPosition(Vec2(origin.x + size.width - closeItem->getContentSize().width/2 ,
                                origin.y + closeItem->getContentSize().height/2));

    auto cl_menu = Menu::create(closeItem, NULL);
    cl_menu->setPosition(Vec2::ZERO);
    this->addChild(cl_menu, 1);
    
    return true;
}
コード例 #10
0
ファイル: prefinterface.cpp プロジェクト: rdp/smplayer-svn
void PrefInterface::getData(Preferences * pref) {
	requires_restart = false;
	language_changed = false;
	iconset_changed = false;
	gui_changed = false;
	style_changed = false;
	recents_changed = false;

	if (pref->language != language()) {
		pref->language = language();
		language_changed = true;
		qDebug("PrefInterface::getData: chosen language: '%s'", pref->language.toUtf8().data());
	}

	if (pref->iconset != iconSet()) {
		pref->iconset = iconSet();
		iconset_changed = true;
	}

	if (pref->gui != GUI()) {
		pref->gui = GUI();
		gui_changed = true;
	}

	pref->resize_method = resizeMethod();
	pref->save_window_size_on_exit = saveSize();

#ifdef SINGLE_INSTANCE
	pref->use_single_instance = useSingleInstance();
#endif

	if (pref->history_recents->maxItems() != recentsMaxItems()) {
		pref->history_recents->setMaxItems( recentsMaxItems() );
		recents_changed = true;
	}

	pref->seeking1 = seeking1();
	pref->seeking2 = seeking2();
	pref->seeking3 = seeking3();
	pref->seeking4 = seeking4();

	pref->update_while_seeking = updateWhileDragging();
	pref->relative_seeking= relativeSeeking();
	pref->precise_seeking = preciseSeeking();

	pref->default_font = defaultFont();

	pref->hide_video_window_on_audio_files = hideVideoOnAudioFiles();

#if STYLE_SWITCHING
    if ( pref->style != style() ) {
        pref->style = style();
		style_changed = true;
	}
#endif

	pref->floating_control_animated = floatingAnimated();
	pref->floating_control_width = floatingWidth();
	pref->floating_control_margin = floatingMargin();
	pref->floating_display_in_compact_mode = displayFloatingInCompactMode();
#ifndef Q_OS_WIN
	pref->bypass_window_manager = floatingBypassWindowManager();
#endif
}
コード例 #11
0
ファイル: MainWindow.cpp プロジェクト: koas/maurina
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    server(NULL), clearTimer(NULL), scControls(NULL), scAbout(NULL),
    scLayout(NULL), scExit(NULL), scPreferences(NULL)
{
    ui->setupUi(this);

    // Get user folder and create app folder
    this->userFolder = QDir::homePath() + "/.maurina/";
    QDir dir;
    if (!dir.exists(this->userFolder))
        dir.mkdir(this->userFolder);

    // Set default values
    this->serverIp = QHostAddress::LocalHost;
    this->serverPort = 1947; // Maurina's year of birth
    this->timeoutEnabled = true;
    this->timeoutValue = 2;
    this->logCount.resize(5);
    this->tabCaptions << "Log 1" << "Log 2" << "Log 3" << "Log4" << "Log5";
    this->controlsVisible = true;
    this->layoutType = DetailedLayout;

    // Set default styles
    QString defaultSize("font-size : 12px;");

    QString defaultFont("font-family : monospace;");
    #ifdef Q_OS_WIN32
    defaultFont = "font-family : Consolas;";
    #endif
    #ifdef Q_OS_MAC
    defaultFont = "font-family : Monaco;";
    #endif
    #ifdef Q_OS_LINUX
    defaultFont = "font-family : \"Liberation Mono\";";
    #endif

    this->styles["time"] = defaultFont + " color : #aaaaaa; " + defaultSize;
    this->styles["pre"]  = defaultFont + " color : #000000; " + defaultSize;
    this->styles["var"]  = defaultFont + " color : #000000; " + defaultSize;
    this->styles["h1"]   = defaultFont + " color : #b50000; " + defaultSize;
    this->styles["h2"]   = defaultFont + " color : #009C39; " + defaultSize;
    this->styles["h3"]   = defaultFont + " color : #000000; " + defaultSize;
    this->styles["h4"]   = defaultFont + " color : #000000; " + defaultSize;
    this->styles["h5"]   = defaultFont + " color : #000000; " + defaultSize;
    this->styles["h6"]   = defaultFont + " color : #000000; " + defaultSize;

    // Load config
    this->loadConfig();

    // Set up UI
    ui->uiTimeoutEnabled->setChecked(this->timeoutEnabled);
    ui->uiTimeoutValue->setValue(this->timeoutValue);

    QString title = "Maurina v.";
    title += VERSION;
    this->setWindowTitle(title);

    ui->actionE_xit->setShortcut(QKeySequence::Quit);
    ui->action_About->setShortcut(QKeySequence::HelpContents);
    ui->action_Preferences->setShortcut(QKeySequence(tr("Ctrl+P")));
    ui->action_HideCntrls->setShortcut(QKeySequence(tr("Ctrl+H")));
    ui->actionChangeLayout->setShortcut(QKeySequence(tr("Ctrl+L")));

    ui->frameCompactLayoutTop->hide();
    ui->frameCompactLayoutBottom->hide();
    ui->tabWidgetA->tabBar()->hide();
    ui->tabWidgetB->tabBar()->hide();
    ui->tabWidgetC->tabBar()->hide();
    ui->tabWidgetD->tabBar()->hide();
    ui->tabWidgetE->tabBar()->hide();

    // UI connections
    connect(ui->uiTimeoutEnabled,   SIGNAL(stateChanged(int)),
            this,                   SLOT(slTimeoutChanged(int)));
    connect(ui->uiTimeoutValue,     SIGNAL(valueChanged(int)),
            this,                   SLOT(slTimeoutChanged(int)));
    connect(ui->uiClearNow,         SIGNAL(clicked()),
            this,                   SLOT(slClearLogs()));
    connect(ui->actionE_xit,        SIGNAL(triggered()),
            this,                   SLOT(close()));
    connect(ui->action_About,       SIGNAL(triggered()),
            this,                   SLOT(slShowAbout()));
    connect(ui->action_Preferences, SIGNAL(triggered()),
            this,                   SLOT(slShowPreferences()));
    connect(ui->action_HideCntrls,  SIGNAL(triggered()),
            this,                   SLOT(slToggleControls()));
    connect(ui->actionChangeLayout, SIGNAL(triggered()),
            this,                   SLOT(slChangeLayout()));

    this->updateControls();
    this->updateLayout();

    // Start server
    this->startServer();
}
コード例 #12
0
int QTextDocument::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: contentsChange((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 1: contentsChanged(); break;
        case 2: undoAvailable((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: redoAvailable((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 4: undoCommandAdded(); break;
        case 5: modificationChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 6: cursorPositionChanged((*reinterpret_cast< const QTextCursor(*)>(_a[1]))); break;
        case 7: blockCountChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 8: documentLayoutChanged(); break;
        case 9: undo(); break;
        case 10: redo(); break;
        case 11: appendUndoItem((*reinterpret_cast< QAbstractUndoItem*(*)>(_a[1]))); break;
        case 12: setModified((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 13: setModified(); break;
        }
        _id -= 14;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isUndoRedoEnabled(); break;
        case 1: *reinterpret_cast< bool*>(_v) = isModified(); break;
        case 2: *reinterpret_cast< QSizeF*>(_v) = pageSize(); break;
        case 3: *reinterpret_cast< QFont*>(_v) = defaultFont(); break;
        case 4: *reinterpret_cast< bool*>(_v) = useDesignMetrics(); break;
        case 5: *reinterpret_cast< QSizeF*>(_v) = size(); break;
        case 6: *reinterpret_cast< qreal*>(_v) = textWidth(); break;
        case 7: *reinterpret_cast< int*>(_v) = blockCount(); break;
        case 8: *reinterpret_cast< qreal*>(_v) = indentWidth(); break;
        case 9: *reinterpret_cast< QString*>(_v) = defaultStyleSheet(); break;
        case 10: *reinterpret_cast< int*>(_v) = maximumBlockCount(); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setUndoRedoEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 1: setModified(*reinterpret_cast< bool*>(_v)); break;
        case 2: setPageSize(*reinterpret_cast< QSizeF*>(_v)); break;
        case 3: setDefaultFont(*reinterpret_cast< QFont*>(_v)); break;
        case 4: setUseDesignMetrics(*reinterpret_cast< bool*>(_v)); break;
        case 6: setTextWidth(*reinterpret_cast< qreal*>(_v)); break;
        case 8: setIndentWidth(*reinterpret_cast< qreal*>(_v)); break;
        case 9: setDefaultStyleSheet(*reinterpret_cast< QString*>(_v)); break;
        case 10: setMaximumBlockCount(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 11;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #13
0
ファイル: qscilexerasm.cpp プロジェクト: rserg/just_asmide
QsciStyle QsciLexerAsm::myStyle(int style)const
{
    return QsciStyle(style,"this",defaultColor(style),defaultPaper(),defaultFont(style),true);
}
コード例 #14
0
ファイル: latexlexer.cpp プロジェクト: lgarcin/LaTeXEditor
QsciStyle LatexLexer::defaultStyle(int style) const
{
    return QsciStyle(style,description(style),defaultColor(style),defaultPaper(style),defaultFont(style),defaultEolFill(style));
}
コード例 #15
0
QVector<QPointF> ArtisticTextShape::calculateAbstractCharacterPositions()
{
    const int totalTextLength = plainText().length();

    QVector<QPointF> charPositions;

    // one more than the number of characters for position after the last character
    charPositions.resize(totalTextLength+1);

    // the character index within the text shape
    int globalCharIndex = 0;

    QPointF charPos(0, 0);
    QPointF advance(0, 0);

    const bool attachedToPath = isOnPath();

    foreach(const ArtisticTextRange &range, m_ranges) {
        QFontMetricsF metrics(QFont(range.font(), &m_paintDevice));
        const QString textRange = range.text();
        const qreal letterSpacing = range.letterSpacing();
        const int localTextLength = textRange.length();

        const bool absoluteXOffset = range.xOffsetType() == ArtisticTextRange::AbsoluteOffset;
        const bool absoluteYOffset = range.yOffsetType() == ArtisticTextRange::AbsoluteOffset;

        // set baseline shift
        const qreal baselineShift = baselineShiftForFontSize(range, defaultFont().pointSizeF());

        for(int localCharIndex = 0; localCharIndex < localTextLength; ++localCharIndex, ++globalCharIndex) {
            // apply offset to character
            if (range.hasXOffset(localCharIndex)) {
                if (absoluteXOffset)
                    charPos.rx() = range.xOffset(localCharIndex);
                else
                    charPos.rx() += range.xOffset(localCharIndex);
            } else {
                charPos.rx() += advance.x();
            }
            if (range.hasYOffset(localCharIndex)) {
                if (absoluteYOffset) {
                    // when attached to a path, absolute y-offsets are ignored
                    if (!attachedToPath)
                        charPos.ry() = range.yOffset(localCharIndex);
                } else {
                    charPos.ry() += range.yOffset(localCharIndex);
                }
            } else {
                charPos.ry() += advance.y();
            }

            // apply baseline shift
            charPos.ry() += baselineShift;

            // save character position of current character
            charPositions[globalCharIndex] = charPos;
            // advance character position
            advance = QPointF(metrics.width(textRange[localCharIndex])+letterSpacing, 0.0);

            charPos.ry() -= baselineShift;
        }
    }