예제 #1
0
/*
 * Maintenance note: Keep in sync with QFontComboBox::setCurrentFont()
 */
void KFontAction::setFont( const QString &family )
{
    qDebug() << "KFontAction::setFont(" << family << ")";

    // Suppress triggered(QString) signal and prevent recursive call to ourself.
    d->settingFont++;

    foreach(QWidget *w, createdWidgets())
    {
        QFontComboBox *cb = qobject_cast<QFontComboBox *>(w);
        qDebug() << "\tw=" << w << "cb=" << cb;

        if(!cb) continue;

        cb->setCurrentFont(QFont(family.toLower()));
        qDebug() << "\t\tw spit back=" << cb->currentFont().family();
    }
예제 #2
0
QWidget* KFontAction::createWidget(QWidget* parent)
{
    qDebug() << "KFontAction::createWidget()";
#ifdef __GNUC__
#warning FIXME: items need to be converted
#endif
    // This is the visual element on the screen.  This method overrides
    // the KSelectAction one, preventing KSelectAction from creating its
    // regular KComboBox.
    QFontComboBox *cb = new QFontComboBox( parent );
    cb->setFontFilters(d->fontFilters);

    qDebug() << "\tset=" << font();
    // Do this before connecting the signal so that nothing will fire.
    cb->setCurrentFont( QFont( font().toLower() ) );
    qDebug() << "\tspit back=" << cb->currentFont().family();

    connect( cb, SIGNAL(currentFontChanged(QFont)), SLOT(_k_slotFontChanged(QFont)) );
    cb->setMinimumWidth( cb->sizeHint().width() );
    return cb;
}
예제 #3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    createStatusBar();

    // Recent files
    for (int i = 0; i < MaxRecentFiles; ++i)
    {
	recentFileActions[i] = new QAction(this);
	recentFileActions[i]->setVisible(false);
	connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile()));
	ui->menuFile->insertAction(ui->actionExit, recentFileActions[i]);
    }
    recentFilesSeparator = ui->menuFile->insertSeparator(ui->actionExit);

    printer = new QPrinter;
    printer->setFullPage(true);
    printer->setPaperSize(QPrinter::Letter);
    printer->setPageMargins(.5, .5, .5, .5, QPrinter::Inch);

    report = new Report(printer, this);
    view = new ReportView(report, this);

    preview = new QPrintPreviewWidget(printer, this);
    setCentralWidget(preview);
    preview->fitToWidth();

    QFontComboBox* fontComboBox = new QFontComboBox;
    fontComboBox->setFontFilters(QFontComboBox::MonospacedFonts | QFontComboBox::ScalableFonts);
    fontComboBox->setCurrentFont(report->font().family());
    ui->fontToolBar->insertWidget(ui->actionBold, fontComboBox);
    connect(fontComboBox, SIGNAL(currentFontChanged(QFont)), report, SLOT(setFont(QFont)));

    pageNumberComboBox = new QComboBox;
    ui->viewToolBar->insertWidget(ui->actionNextPage, pageNumberComboBox);
    connect(pageNumberComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentPageChanged(int)));

    const qreal zoomFactors[] = { 12.5, 25, 50, 100, 125, 150, 200, 400, 800 };
    zoomComboBox = new QComboBox;
    for (unsigned int i = 0; i < sizeof(zoomFactors) / sizeof(*zoomFactors); ++i)
    {
	zoomComboBox->addItem(QString("%1%").arg(zoomFactors[i]));
    }
    zoomComboBox->setCurrentIndex(-1);
    ui->viewToolBar->insertWidget(ui->actionZoomOut, zoomComboBox);
    connect(zoomComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(zoomChanged(QString)));

    QActionGroup* orientationGroup = new QActionGroup(this);
    orientationGroup->addAction(ui->actionPortrait);
    orientationGroup->addAction(ui->actionLandscape);
    orientationChanged(report->orientation());

    QActionGroup* heightGroup = new QActionGroup(this);
    heightGroup->addAction(ui->action6LPI);
    heightGroup->addAction(ui->action8LPI);
    heightGroup->addAction(ui->action9LPI);
    heightGroup->setDisabled(ui->actionStretchFont->isEnabled());
    connect(ui->actionStretchFont, SIGNAL(toggled(bool)), heightGroup, SLOT(setDisabled(bool)));

    QActionGroup* widthGroup = new QActionGroup(this);
    widthGroup->addAction(ui->actionDefaultWidth);
    widthGroup->addAction(ui->action10CPI);
    widthGroup->addAction(ui->action12CPI);
    widthGroup->addAction(ui->action17CPI);
    widthGroup->setDisabled(ui->actionStretchFont->isEnabled());
    connect(ui->actionStretchFont, SIGNAL(toggled(bool)), widthGroup, SLOT(setDisabled(bool)));

    QActionGroup* pageGroup = new QActionGroup(this);
    pageGroup->addAction(ui->actionSinglePage);
    pageGroup->addAction(ui->actionFacingPages);
    pageGroup->addAction(ui->actionAllPages);
    ui->actionSinglePage->setChecked(preview->viewMode() == QPrintPreviewWidget::SinglePageView);
    ui->actionFacingPages->setChecked(preview->viewMode() == QPrintPreviewWidget::FacingPagesView);
    ui->actionAllPages->setChecked(preview->viewMode() == QPrintPreviewWidget::AllPagesView);

    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
    connect(ui->actionOpenURL, SIGNAL(triggered()), this, SLOT(openUrl()));
    connect(ui->actionReload, SIGNAL(triggered()), this, SLOT(reload()));
    connect(ui->actionSaveAsPDF, SIGNAL(triggered()), this, SLOT(saveAsPdf()));
    connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print()));
    connect(ui->actionPageSetup, SIGNAL(triggered()), this, SLOT(pageSetup()));
    connect(ui->actionEmail, SIGNAL(triggered()), this, SLOT(email()));
    connect(ui->actionCopy, SIGNAL(triggered()), this, SLOT(copy()));
    connect(ui->actionStretchFont, SIGNAL(toggled(bool)), report, SLOT(setStretchFont(bool)));
    connect(report, SIGNAL(stretchFontChanged(bool)), ui->actionStretchFont, SLOT(setChecked(bool)));
    connect(ui->actionBold, SIGNAL(toggled(bool)), report, SLOT(setBold(bool)));
    connect(ui->actionStripes, SIGNAL(toggled(bool)), report, SLOT(setStripes(bool)));
    connect(ui->actionStripeColor, SIGNAL(triggered()), this, SLOT(stripeColor()));
    connect(ui->actionColor, SIGNAL(triggered()), this, SLOT(fontColor()));
    connect(ui->action6LPI, SIGNAL(triggered()), this, SLOT(height6Lpi()));
    connect(ui->action8LPI, SIGNAL(triggered()), this, SLOT(height8Lpi()));
    connect(ui->action9LPI, SIGNAL(triggered()), this, SLOT(height9Lpi()));
    connect(ui->actionDefaultWidth, SIGNAL(toggled(bool)), this, SLOT(widthDefault()));
    connect(ui->action10CPI, SIGNAL(triggered()), this, SLOT(width10Cpi()));
    connect(ui->action12CPI, SIGNAL(triggered()), this, SLOT(width12Cpi()));
    connect(ui->action17CPI, SIGNAL(triggered()), this, SLOT(width17Cpi()));
    connect(ui->actionFirstPage, SIGNAL(triggered()), this, SLOT(firstPage()));
    connect(ui->actionPreviousPage, SIGNAL(triggered()), this, SLOT(previousPage()));
    connect(ui->actionNextPage, SIGNAL(triggered()), this, SLOT(nextPage()));
    connect(ui->actionLastPage, SIGNAL(triggered()), this, SLOT(lastPage()));
    connect(ui->actionFitWidth, SIGNAL(triggered()), preview, SLOT(fitToWidth()));
    connect(ui->actionFitHeight, SIGNAL(triggered()), preview, SLOT(fitInView()));
    connect(ui->actionPortrait, SIGNAL(triggered()), preview, SLOT(setPortraitOrientation()));
    connect(ui->actionLandscape, SIGNAL(triggered()), preview, SLOT(setLandscapeOrientation()));
    connect(ui->actionActualSize, SIGNAL(triggered()), this, SLOT(actualSize()));
    connect(ui->actionZoomIn, SIGNAL(triggered()), preview, SLOT(zoomIn()));
    connect(ui->actionZoomOut, SIGNAL(triggered()), preview, SLOT(zoomOut()));
    connect(ui->actionSinglePage, SIGNAL(triggered()), preview, SLOT(setSinglePageViewMode()));
    connect(ui->actionFacingPages, SIGNAL(triggered()), preview, SLOT(setFacingPagesViewMode()));
    connect(ui->actionAllPages, SIGNAL(triggered()), preview, SLOT(setAllPagesViewMode()));
    connect(ui->actionMainToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleMainToolbar(bool)));
    connect(ui->actionViewToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleViewToolbar(bool)));
    connect(ui->actionFontToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleFontToolbar(bool)));
    connect(ui->actionStatusBar, SIGNAL(triggered(bool)), this, SLOT(toggleStatusBar(bool)));
    connect(ui->menuToolbars, SIGNAL(aboutToShow()), this, SLOT(updateToolbarMenu()));
    connect(ui->menuView, SIGNAL(aboutToShow()), this, SLOT(updateToolbarMenu()));
    connect(preview, SIGNAL(previewChanged()), this, SLOT(previewChanged()));

    connect(preview, SIGNAL(paintRequested(QPrinter*)), this, SLOT(paint(QPrinter*)));
    connect(report, SIGNAL(loaded()), preview, SLOT(updatePreview()));
    connect(report, SIGNAL(changed()), preview, SLOT(updatePreview()));
    connect(report, SIGNAL(loaded()), this, SLOT(documentLoaded()));
    connect(report, SIGNAL(orientationChanged(QPrinter::Orientation)), this, SLOT(orientationChanged(QPrinter::Orientation)));
    connect(report, SIGNAL(lpiChanged(int)), this, SLOT(lpiChanged(int)));
    connect(report, SIGNAL(cpiChanged(int)), this, SLOT(cpiChanged(int)));
    connect(report, SIGNAL(boldChanged(bool)), ui->actionBold, SLOT(setChecked(bool)));
    connect(report, SIGNAL(fontChanged(QFont)), fontComboBox, SLOT(setCurrentFont(QFont)));

    QSettings settings;
    restoreGeometry(settings.value("geometry").toByteArray());
    restoreState(settings.value("state").toByteArray());
    recentFiles = settings.value("recentFiles").toStringList();
    currentFolder = settings.value("currentFolder").toString();
    ui->statusBar->setVisible(settings.value("statusBar", true).toBool());

    updateRecentFileActions();

    zoomTimer = new QTimer(this);
    connect(zoomTimer, SIGNAL(timeout()), this, SLOT(updateZoom()));
    connect(preview, SIGNAL(previewChanged()), this, SLOT(updateZoom()));
    zoomTimer->start(1000);
}
예제 #4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    EdamProtocol *edam = EdamProtocol::GetInstance();

    ui->setupUi(this);

    pdfCache * pdf = new pdfCache(this);

    CustomNetworkAccessManager *nm = new CustomNetworkAccessManager(ui->editor->page()->networkAccessManager(), this, pdf);
    edam->setCNAM(nm);
    ui->editor->page()->setNetworkAccessManager(nm);

    Speller::setSettings(new DBSpellSettings(this, ui->editor));

    ui->editor->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->editor->load(QUrl("qrc:///html/noteajax.html"));

    jsB = new jsBridge(this, pdf);
    jsB->setWebView(ui->editor);
    enmlWritter = new enml2(this);

    connect(ui->editor->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJSObject()));

    loaded = false;
    editingEnabled = false;


    tagsActions = new QActionGroup(this);
    newTag = new TagLabel(this);
    newTag->hide();
    ui->tagsBar->addWidget(newTag);

    appIcon = QIcon(":img/hippo64.png");

    trayIcon = NULL;

    bool sysTrayEnabled = sql::readSyncStatus("systemTray", true).toBool();

    if (QSystemTrayIcon::isSystemTrayAvailable() && sysTrayEnabled)
        enableSystemTrayIcon(true);

    connect(edam, SIGNAL(AuthenticateFailed()), this, SLOT(authentificationFailed()));
    connect(edam, SIGNAL(syncFinished()), this, SLOT(syncFinished()));
    connect(edam, SIGNAL(syncStarted(int)), this, SLOT(syncStarted(int)));
    connect(edam, SIGNAL(noteGuidChanged(QString,QString)), this, SLOT(changeNoteGuid(QString,QString)));
    connect(ui->notebooks, SIGNAL(itemSelectionChanged()), this, SLOT(switchNotebook()));
    connect(ui->tags, SIGNAL(itemSelectionChanged()), this, SLOT(switchTag()));
    connect(ui->tags, SIGNAL(tagAdded(QString,QString)), this, SLOT(addTag(QString,QString)));
    connect(ui->tags, SIGNAL(tagsUpdated()), this, SLOT(updateTagsToolBar()));
    connect(ui->tags, SIGNAL(tagsUpdated()), this, SLOT(switchTag()));
    connect(ui->NotesList, SIGNAL(noteSwitched()), this, SLOT(switchNote()));
    connect(ui->action_Abaut, SIGNAL(triggered()), this, SLOT(loadAboutInfo()));
    connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(closeWindow()));
    connect(ui->actionNew_Note, SIGNAL(triggered()), this, SLOT(newNote()));
    connect(ui->actionSync, SIGNAL(triggered()), this, SLOT(sync()));
    connect(ui->noteTitle, SIGNAL(textEdited(QString)), this, SLOT(noteTitleChange(QString)));
    connect(ui->actionAccount_info, SIGNAL(triggered()), this, SLOT(showUserInfo()));
    connect(ui->editor->page(), SIGNAL(linkClicked(QUrl)), this, SLOT(openURL(QUrl)));
    connect(ui->editor->page(), SIGNAL(microFocusChanged()), this, SLOT(updateEditButtonsState()));
    connect(ui->editor, SIGNAL(selectionChanged()), this, SLOT(updateSelectionButtonsState()));
    connect(ui->editor->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));
    connect(ui->editor, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(editorContextMenuRequested(QPoint)));
    connect(ui->editor, SIGNAL(fileInserted(QString)), this, SLOT(insertFile(QString)));
    connect(ui->notebooks, SIGNAL(noteMoved(QString,QString)), this, SLOT(moveNote(QString,QString)));
    connect(ui->notebooks, SIGNAL(noteDeleted(QString)), this, SLOT(deleteNote(QString)));
    connect(ui->notebooks, SIGNAL(noteRestored(QString,QString)), this, SLOT(restoreNote(QString,QString)));
    connect(ui->NotesList, SIGNAL(noteDeleted(QString)), this, SLOT(deleteNote(QString)));
    connect(ui->NotesList, SIGNAL(noteRestored(QString)), this, SLOT(restoreNote(QString)));
    connect(ui->NotesList, SIGNAL(noteCreated()), this, SLOT(newNote()));
    connect(ui->NotesList, SIGNAL(reloaded()), this, SLOT(updateCurrentNoteName()));
    connect(ui->editButton, SIGNAL(toggled(bool)), this, SLOT(setEditable(bool)));
    connect(ui->actionDelete_Note, SIGNAL(triggered()), this, SLOT(deleteNote()));
    connect(ui->toolBox, SIGNAL(currentChanged(int)), this, SLOT(changeTab(int)));
    connect(ui->editor->page(), SIGNAL(linkHovered(QString,QString,QString)), this, SLOT(linkHovered(QString,QString,QString)));
    connect(jsB, SIGNAL(hintMessage(QString,int)), ui->statusbar, SLOT(showMessage(QString,int)));
    connect(jsB, SIGNAL(noteChanged(QString)), this, SLOT(updateTagsToolBar(QString)));
    connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->actionDelete_Note, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->editButton, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(editingStarted(bool)), ui->editButton, SLOT(setChecked(bool)));
    connect(jsB, SIGNAL(titleUpdated(QString,QString)), this, SLOT(updateNoteTitle(QString,QString)));
    connect(jsB, SIGNAL(conflictAdded(qint64,QString,bool)), this, SLOT(addConflict(qint64,QString,bool)));
    connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionNote_Info, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionExport, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionPrint, SLOT(setEnabled(bool)));
    connect(ui->editor, SIGNAL(tagUpdated(QString,bool)), this, SLOT(updateTag(QString,bool)));
    connect(tagsActions, SIGNAL(triggered(QAction*)), this, SLOT(tagClicked(QAction*)));
    connect(newTag, SIGNAL(tagCreated(QString)), this, SLOT(createTag(QString)));
    connect(ui->actionKeep_only_this_Version, SIGNAL(triggered()), this, SLOT(keepThisVersion()));
    connect(ui->actionNote_Info, SIGNAL(triggered()), this, SLOT(showNoteInfo()));
    connect(ui->actionExport, SIGNAL(triggered()), this, SLOT(exportNote()));
    connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print()));
    connect(this, SIGNAL(titleChanged(QString,QString)), jsB, SIGNAL(titleChanged(QString,QString)));


    setWindowIcon(appIcon);
    setWindowTitle("Hippo Notes");

    setTabOrder(ui->noteTitle, ui->editor);

    ui->notebooks->setSortingEnabled(true);
    ui->notebooks->sortByColumn(0, Qt::AscendingOrder);
    ui->editBar->setVisible(false);

    ui->mainToolBar->addAction(ui->actionNew_Note);
    ui->mainToolBar->addAction(ui->actionSync);

    QFontComboBox *font = new QFontComboBox(this);
    font->setDisabled(true);
    font->setFontFilters(QFontComboBox::ScalableFonts);
    font->setEditable(false);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), font, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(updateFont(QFont)), font, SLOT(setCurrentFont(QFont)));
    connect(font, SIGNAL(activated(QString)), this, SLOT(changeFont(QString)));
    ui->editBar->addWidget(font);

    QComboBox *fontSize = new QComboBox(this);
    fontSize->setDisabled(true);
    fontSize->setEditable(false);
    for (int i = 1; i <= 7; i++)
        fontSize->addItem(QString::number(i));
    connect(this, SIGNAL(editButtonsStateChanged(bool)), fontSize, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(updateFontSize(int)), fontSize, SLOT(setCurrentIndex(int)));
    connect(fontSize, SIGNAL(activated(QString)), this, SLOT(changeFontSize(QString)));
    ui->editBar->addWidget(fontSize);

    QAction *boldIco = ui->editor->pageAction(QWebPage::ToggleBold);
    boldIco->setIcon(QIcon::fromTheme("format-text-bold"));
    ui->editBar->addAction(boldIco);

    QAction *italicIco = ui->editor->pageAction(QWebPage::ToggleItalic);
    italicIco->setIcon(QIcon::fromTheme("format-text-italic"));
    ui->editBar->addAction(italicIco);

    QAction *underlineIco = ui->editor->pageAction(QWebPage::ToggleUnderline);
    underlineIco->setIcon(QIcon::fromTheme("format-text-underline"));
    ui->editBar->addAction(underlineIco);

    QAction *strikethroughIco = ui->editor->pageAction(QWebPage::ToggleStrikethrough);
    strikethroughIco->setIcon(QIcon::fromTheme("format-text-strikethrough"));
    ui->editBar->addAction(strikethroughIco);

    ui->editBar->addSeparator();

    QAction *undoIco = ui->editor->pageAction(QWebPage::Undo);
    undoIco->setIcon(QIcon::fromTheme("edit-undo"));
    undoIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
    ui->editBar->addAction(undoIco);
    ui->menu_Edit->addAction(undoIco);

    QAction *redoIco = ui->editor->pageAction(QWebPage::Redo);
    redoIco->setIcon(QIcon::fromTheme("edit-redo"));
    redoIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z));
    ui->editBar->addAction(redoIco);
    ui->menu_Edit->addAction(redoIco);

    ui->editBar->addSeparator();

    QAction *rformatIco = ui->editor->pageAction(QWebPage::RemoveFormat);
    rformatIco->setIcon(QIcon::fromTheme("edit-clear"));
    ui->editBar->addAction(rformatIco);

    ui->editBar->addSeparator();

    QAction *leftIco = ui->editor->pageAction(QWebPage::AlignLeft);
    leftIco->setIcon(QIcon::fromTheme("format-justify-left"));
    ui->editBar->addAction(leftIco);

    QAction *centerIco = ui->editor->pageAction(QWebPage::AlignCenter);
    centerIco->setIcon(QIcon::fromTheme("format-justify-center"));
    ui->editBar->addAction(centerIco);

    QAction *rightIco = ui->editor->pageAction(QWebPage::AlignRight);
    rightIco->setIcon(QIcon::fromTheme("format-justify-right"));
    ui->editBar->addAction(rightIco);

    QAction *fillIco = ui->editor->pageAction(QWebPage::AlignJustified);
    fillIco->setIcon(QIcon::fromTheme("format-justify-fill"));
    ui->editBar->addAction(fillIco);

    ui->editBar->addSeparator();

    QAction *indentIco = ui->editor->pageAction(QWebPage::Indent);
    indentIco->setIcon(QIcon::fromTheme("format-indent-more"));
    ui->editBar->addAction(indentIco);

    QAction *outdentIco = ui->editor->pageAction(QWebPage::Outdent);
    outdentIco->setIcon(QIcon::fromTheme("format-indent-less"));
    ui->editBar->addAction(outdentIco);

    QAction *superscriptIco = ui->editor->pageAction(QWebPage::ToggleSuperscript);
    superscriptIco->setIcon(QIcon::fromTheme("format-text-superscript"));
    ui->editBar->addAction(superscriptIco);

    QAction *subscriptIco = ui->editor->pageAction(QWebPage::ToggleSubscript);
    subscriptIco->setIcon(QIcon::fromTheme("format-text-subscript"));
    ui->editBar->addAction(subscriptIco);

    QAction *unorderedIco = ui->editor->pageAction(QWebPage::InsertUnorderedList);
    unorderedIco->setIcon(QIcon::fromTheme("format-list-unordered"));
    ui->editBar->addAction(unorderedIco);

    QAction *orderedIco = ui->editor->pageAction(QWebPage::InsertOrderedList);
    orderedIco->setIcon(QIcon::fromTheme("format-list-ordered"));
    ui->editBar->addAction(orderedIco);

    QAction *lineIco = new QAction("Insert horizontal line", this);
    lineIco->setIcon(QIcon::fromTheme("insert-horizontal-rule"));
    lineIco->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), lineIco, SLOT(setEnabled(bool)));
    connect(lineIco, SIGNAL(triggered()), this, SLOT(insertHorizontalLine()));
    ui->editBar->addAction(lineIco);

    ui->menu_Edit->addSeparator();

    QAction *cutIco = ui->editor->pageAction(QWebPage::Cut);
    cutIco->setIcon(QIcon::fromTheme("edit-cut"));
    cutIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
    ui->menu_Edit->addAction(cutIco);

    QAction *copyIco = ui->editor->pageAction(QWebPage::Copy);
    copyIco->setIcon(QIcon::fromTheme("edit-copy"));
    copyIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
    ui->menu_Edit->addAction(copyIco);

    QAction *pasteIco = ui->editor->pageAction(QWebPage::Paste);
    pasteIco->setIcon(QIcon::fromTheme("edit-paste"));
    pasteIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
    ui->menu_Edit->addAction(pasteIco);

    QAction *pasteSpecialIco = ui->editor->pageAction(QWebPage::PasteAndMatchStyle);
    pasteSpecialIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V));
    ui->menu_Edit->addAction(pasteSpecialIco);

    ui->menu_Edit->addSeparator();

    QAction *insertUrlIco = new QAction("Create link", this);
    insertUrlIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
    insertUrlIco->setDisabled(true);
    insertUrlIco->setIcon(QIcon::fromTheme("insert-link"));
    connect(this, SIGNAL(selectionButtonsStateChanged(bool)), insertUrlIco, SLOT(setDisabled(bool)));
    connect(insertUrlIco, SIGNAL(triggered()), this, SLOT(insertUrl()));
    ui->menu_Edit->addAction(insertUrlIco);

    QAction *todoIco = new QAction("Insert To-do Checkbox", this);
    todoIco->setIcon(QIcon::fromTheme("checkbox"));
    todoIco->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), todoIco, SLOT(setEnabled(bool)));
    connect(todoIco, SIGNAL(triggered()), jsB, SIGNAL(insertToDo()));
    ui->menu_Edit->addAction(todoIco);

    QAction *insertImage = new QAction("Insert Image", this);
    insertImage->setIcon(QIcon::fromTheme("insert-image"));
    insertImage->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), insertImage, SLOT(setEnabled(bool)));
    connect(insertImage, SIGNAL(triggered()), this, SLOT(insertImg()));
    ui->menu_Edit->addAction(insertImage);

    QAction *insertFile = new QAction("Insert File", this);
    insertFile->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), insertFile, SLOT(setEnabled(bool)));
    connect(insertFile, SIGNAL(triggered()), this, SLOT(insertFile()));
    ui->menu_Edit->addAction(insertFile);

    QAction *encryptIco = new QAction("Encrypt Selected Text...", this);
    encryptIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_X));
    encryptIco->setDisabled(true);
    encryptIco->setIcon(QIcon::fromTheme("document-edit-encrypt"));
    connect(this, SIGNAL(selectionButtonsStateChanged(bool)), encryptIco, SLOT(setDisabled(bool)));
    connect(encryptIco, SIGNAL(triggered()), jsB, SIGNAL(encryptText()));
    ui->menu_Edit->addAction(encryptIco);

    ui->menu_Edit->addSeparator();

    QAction *options = new QAction("&Options...", this);
    options->setIcon(QIcon::fromTheme("preferences-other"));
    connect(options, SIGNAL(triggered()), this, SLOT(showOptions()));
    ui->menu_Edit->addAction(options);


    clearConflictBar();
    connect(jsB, SIGNAL(showConflict()), ui->conflictBar, SLOT(show()));
    connect(jsB, SIGNAL(showConflict()), ui->conflictBarBottom, SLOT(show()));

    conflictsGroup = new QActionGroup(this);
    connect(conflictsGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeNoteVersion(QAction*)));

    searchIndex = new SearchIndex(this);
    connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(search()));
    connect(edam, SIGNAL(syncFinished()), searchIndex, SLOT(buildSearchIndex()));
    connect(jsB, SIGNAL(noteUpdated(QString)), searchIndex, SLOT(updateNoteIndex(QString)));
    connect(edam, SIGNAL(noteUpdated(QString)), searchIndex, SLOT(dropNoteIndex(QString)));
    connect(ui->searchInput, SIGNAL(returnPressed()), this, SLOT(search()));

    QByteArray mainWindowGeometry = sql::readSyncStatus("mainWindowGeometry").toString().toLatin1();
    if (!mainWindowGeometry.isEmpty())
        restoreGeometry(QByteArray::fromBase64(mainWindowGeometry));

    QByteArray mainWidgetsSplitterState = sql::readSyncStatus("mainWidgetsSplitterState").toString().toLatin1();
    if (!mainWidgetsSplitterState.isEmpty())
        ui->mainWidgetsSplitter->restoreState(QByteArray::fromBase64(mainWidgetsSplitterState));

    //showWindow();
    edam->init();
}
예제 #5
0
SimpleFontDialog::SimpleFontDialog(const QFont& initial, QWidget* parent)
    : QDialog(parent)
{
    QFontComboBox* fontComboBox = new QFontComboBox(this);
    fontComboBox->setCurrentFont(initial);
    font = initial;

    QVBoxLayout* familyLayout = new QVBoxLayout();
    familyLayout->addWidget(new QLabel(tr("Family")));
    familyLayout->addWidget(fontComboBox);

    QList<int> sizes = QFontDatabase::standardSizes();

    QComboBox* sizeComboBox = new QComboBox(this);
    sizeComboBox->setEditable(true);

    QIntValidator* sizeValidator = new QIntValidator(1, 512, this);
    sizeComboBox->setValidator(sizeValidator);

    int currentSizeIndex = 0;
    QFontInfo fontInfo(initial);
    bool currentFontInserted = false;

    for (int i = 0; i < sizes.size(); i++)
    {
        int size = sizes[i];

        // If the current font size is a non-standard size, then insert
        // it in the appropriate place in the sorted list of fonts.
        //
        if ((fontInfo.pointSize() < size) && !currentFontInserted)
        {
            currentSizeIndex = i;
            sizeComboBox->addItem(QString("%1").arg(fontInfo.pointSize()), fontInfo.pointSize());
            currentFontInserted = true;
        }
        // Else current font size is in the standard font sizes list.  Set
        // the index in the combo box to its position in the list.
        //
        else
        {
            if (fontInfo.pointSize() == size)
            {
                currentSizeIndex = i;
                currentFontInserted = true;
            }
        }

        sizeComboBox->addItem(QString("%1").arg(size), size);
    }

    if (!currentFontInserted)
    {
        sizeComboBox->addItem(QString("%1").arg(fontInfo.pointSize()), fontInfo.pointSize());
        currentSizeIndex = sizeComboBox->count() - 1;
    }

    sizeComboBox->setCurrentIndex(currentSizeIndex);

    QVBoxLayout* sizeLayout = new QVBoxLayout();
    sizeLayout->addWidget(new QLabel(tr("Size")));
    sizeLayout->addWidget(sizeComboBox);

    fontPreview = new QLineEdit(tr("AaBbCcXxYyZz"), this);
    fontPreview->setFont(initial);

    QVBoxLayout* previewLayout = new QVBoxLayout();
    previewLayout->addWidget(new QLabel(tr("Preview")));
    previewLayout->addWidget(fontPreview);

    QDialogButtonBox* buttonBox = new QDialogButtonBox(Qt::Horizontal, this);
    buttonBox->addButton(QDialogButtonBox::Ok);
    buttonBox->addButton(QDialogButtonBox::Cancel);

    QGridLayout* layout = new QGridLayout();
    layout->addItem(familyLayout, 0, 0);
    layout->addItem(sizeLayout, 0, 1);
    layout->addItem(previewLayout, 1, 0, 1, 2, Qt::AlignCenter);
    layout->addWidget(buttonBox, 2, 0, 1, 2);

    setLayout(layout);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    connect(fontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(onFontFamilyChanged(const QFont&)));
    connect(sizeComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(onFontSizeChanged(const QString&)));
    connect(sizeComboBox, SIGNAL(editTextChanged(QString)), this, SLOT(onFontSizeChanged(const QString&)));
}
예제 #6
0
int main(int argc, char **argv)
{
    //! [0]
    QApplication app(argc, argv);
    Q3DScatter *graph = new Q3DScatter();
    QWidget *container = QWidget::createWindowContainer(graph);
    //! [0]

    if (!graph->hasContext()) {
        QMessageBox msgBox;
        msgBox.setText("Couldn't initialize the OpenGL context.");
        msgBox.exec();
        return -1;
    }

    QSize screenSize = graph->screen()->size();
    container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 1.5));
    container->setMaximumSize(screenSize);
    container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    container->setFocusPolicy(Qt::StrongFocus);

    //! [1]
    QWidget *widget = new QWidget;
    QHBoxLayout *hLayout = new QHBoxLayout(widget);
    QVBoxLayout *vLayout = new QVBoxLayout();
    hLayout->addWidget(container, 1);
    hLayout->addLayout(vLayout);
    //! [1]

    widget->setWindowTitle(QStringLiteral("A Cosine Wave"));

    //! [4]
    QComboBox *themeList = new QComboBox(widget);
    themeList->addItem(QStringLiteral("Qt"));
    themeList->addItem(QStringLiteral("Primary Colors"));
    themeList->addItem(QStringLiteral("Digia"));
    themeList->addItem(QStringLiteral("Stone Moss"));
    themeList->addItem(QStringLiteral("Army Blue"));
    themeList->addItem(QStringLiteral("Retro"));
    themeList->addItem(QStringLiteral("Ebony"));
    themeList->addItem(QStringLiteral("Isabelle"));
    themeList->setCurrentIndex(6);

    QPushButton *labelButton = new QPushButton(widget);
    labelButton->setText(QStringLiteral("Change label style"));

    QCheckBox *smoothCheckBox = new QCheckBox(widget);
    smoothCheckBox->setText(QStringLiteral("Smooth dots"));
    smoothCheckBox->setChecked(true);

    QComboBox *itemStyleList = new QComboBox(widget);
    itemStyleList->addItem(QStringLiteral("Sphere"), int(QAbstract3DSeries::MeshSphere));
    itemStyleList->addItem(QStringLiteral("Cube"), int(QAbstract3DSeries::MeshCube));
    itemStyleList->addItem(QStringLiteral("Minimal"), int(QAbstract3DSeries::MeshMinimal));
    itemStyleList->addItem(QStringLiteral("Point"), int(QAbstract3DSeries::MeshPoint));
    itemStyleList->setCurrentIndex(0);

    QPushButton *cameraButton = new QPushButton(widget);
    cameraButton->setText(QStringLiteral("Change camera preset"));

    QPushButton *itemCountButton = new QPushButton(widget);
    itemCountButton->setText(QStringLiteral("Toggle item count"));

    QCheckBox *backgroundCheckBox = new QCheckBox(widget);
    backgroundCheckBox->setText(QStringLiteral("Show background"));
    backgroundCheckBox->setChecked(true);

    QCheckBox *gridCheckBox = new QCheckBox(widget);
    gridCheckBox->setText(QStringLiteral("Show grid"));
    gridCheckBox->setChecked(true);

    QComboBox *shadowQuality = new QComboBox(widget);
    shadowQuality->addItem(QStringLiteral("None"));
    shadowQuality->addItem(QStringLiteral("Low"));
    shadowQuality->addItem(QStringLiteral("Medium"));
    shadowQuality->addItem(QStringLiteral("High"));
    shadowQuality->addItem(QStringLiteral("Low Soft"));
    shadowQuality->addItem(QStringLiteral("Medium Soft"));
    shadowQuality->addItem(QStringLiteral("High Soft"));
    shadowQuality->setCurrentIndex(4);

    QFontComboBox *fontList = new QFontComboBox(widget);
    fontList->setCurrentFont(QFont("Arial"));
    //! [4]

    //! [5]
    vLayout->addWidget(labelButton, 0, Qt::AlignTop);
    vLayout->addWidget(cameraButton, 0, Qt::AlignTop);
    vLayout->addWidget(itemCountButton, 0, Qt::AlignTop);
    vLayout->addWidget(backgroundCheckBox);
    vLayout->addWidget(gridCheckBox);
    vLayout->addWidget(smoothCheckBox, 0, Qt::AlignTop);
    vLayout->addWidget(new QLabel(QStringLiteral("Change dot style")));
    vLayout->addWidget(itemStyleList);
    vLayout->addWidget(new QLabel(QStringLiteral("Change theme")));
    vLayout->addWidget(themeList);
    vLayout->addWidget(new QLabel(QStringLiteral("Adjust shadow quality")));
    vLayout->addWidget(shadowQuality);
    vLayout->addWidget(new QLabel(QStringLiteral("Change font")));
    vLayout->addWidget(fontList, 1, Qt::AlignTop);
    //! [5]

    //! [2]
    ScatterDataModifier *modifier = new ScatterDataModifier(graph);
    //! [2]

    //! [6]
    QObject::connect(cameraButton, &QPushButton::clicked, modifier,
                     &ScatterDataModifier::changePresetCamera);
    QObject::connect(labelButton, &QPushButton::clicked, modifier,
                     &ScatterDataModifier::changeLabelStyle);
    QObject::connect(itemCountButton, &QPushButton::clicked, modifier,
                     &ScatterDataModifier::toggleItemCount);

    QObject::connect(backgroundCheckBox, &QCheckBox::stateChanged, modifier,
                     &ScatterDataModifier::setBackgroundEnabled);
    QObject::connect(gridCheckBox, &QCheckBox::stateChanged, modifier,
                     &ScatterDataModifier::setGridEnabled);
    QObject::connect(smoothCheckBox, &QCheckBox::stateChanged, modifier,
                     &ScatterDataModifier::setSmoothDots);

    QObject::connect(modifier, &ScatterDataModifier::backgroundEnabledChanged,
                     backgroundCheckBox, &QCheckBox::setChecked);
    QObject::connect(modifier, &ScatterDataModifier::gridEnabledChanged,
                     gridCheckBox, &QCheckBox::setChecked);
    QObject::connect(itemStyleList, SIGNAL(currentIndexChanged(int)), modifier,
                     SLOT(changeStyle(int)));

    QObject::connect(themeList, SIGNAL(currentIndexChanged(int)), modifier,
                     SLOT(changeTheme(int)));

    QObject::connect(shadowQuality, SIGNAL(currentIndexChanged(int)), modifier,
                     SLOT(changeShadowQuality(int)));

    QObject::connect(modifier, &ScatterDataModifier::shadowQualityChanged, shadowQuality,
                     &QComboBox::setCurrentIndex);
    QObject::connect(graph, &Q3DScatter::shadowQualityChanged, modifier,
                     &ScatterDataModifier::shadowQualityUpdatedByVisual);

    QObject::connect(fontList, &QFontComboBox::currentFontChanged, modifier,
                     &ScatterDataModifier::changeFont);

    QObject::connect(modifier, &ScatterDataModifier::fontChanged, fontList,
                     &QFontComboBox::setCurrentFont);
    //! [6]

    //! [3]
    widget->show();
    return app.exec();
    //! [3]
}
예제 #7
0
void PropertiesEditorItem::prepareWidget()
{
    QWidget *editor = 0;

    if (mProperty.type() == QVariant::BitArray) {

    } else if (mProperty.type() == QVariant::Bitmap) {

    } else if (mProperty.type() == QVariant::Bool) {
        QCheckBox *checkBox = new QCheckBox(parent());
        checkBox->setText(QString());
        checkBox->setChecked(mProperty.read(mObject.data()).toBool());
        editor = qobject_cast< QWidget* >(checkBox);
        connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotCheckBoxToggled()));

    } else if (mProperty.type() == QVariant::Brush) {

    } else if (mProperty.type() == QVariant::ByteArray) {

    } else if (mProperty.type() == QVariant::Char) {

    } else if (mProperty.type() == QVariant::Color) {
        QPushButton *button = new QPushButton(parent());
        button->setText(mProperty.read(mObject.data()).value<QColor>().name());
        connect(button, SIGNAL(clicked(bool)), SLOT(slotOpenColorEditor()));
        editor = qobject_cast< QWidget* >(button);

    } else if (mProperty.type() == QVariant::Cursor) {

    } else if (mProperty.type() == QVariant::Date) {

    } else if (mProperty.type() == QVariant::DateTime) {

    } else if (mProperty.type() == QVariant::Double) {
        QDoubleSpinBox *spinBox = new QDoubleSpinBox(parent());
        spinBox->setMaximum(LONG_MAX);
        spinBox->setMinimum(LONG_MIN);
        spinBox->setSingleStep(0.01);
        spinBox->setValue(mProperty.read(mObject.data()).toDouble());
        editor = qobject_cast< QWidget* >(spinBox);
        connect(spinBox, SIGNAL(valueChanged(double)), SLOT(slotDoubleSpinBoxValueChanged()));

    } else if (mProperty.type() == QVariant::EasingCurve) {
        QPushButton *button = new QPushButton(parent());
        QEasingCurve curve = mProperty.read(mObject.data()).toEasingCurve();
        button->setText(curve.staticMetaObject.enumerator(0).valueToKey(curve.type()));
        connect(button, SIGNAL(clicked(bool)), SLOT(slotOpenEasingCurveEditor()));
        editor = qobject_cast< QWidget* >(button);

    } else if (mProperty.type() == QVariant::Font) {
        QFontComboBox *comboBox = new QFontComboBox(parent());
        comboBox->setCurrentFont(mProperty.read(mObject.data()).value<QFont>());
        editor = qobject_cast< QWidget* >(comboBox);
        connect(comboBox, SIGNAL(currentFontChanged(QFont)), SLOT(slotFontComboChanged()));

    } else if (mProperty.type() == QVariant::Hash) {

    } else if (mProperty.type() == QVariant::Icon) {

    } else if (mProperty.type() == QVariant::Image) {

    } else if (mProperty.type() == QVariant::Int) {
        QSpinBox *spinBox = new QSpinBox(parent());
        spinBox->setMinimum(INT_MIN);
        spinBox->setMaximum(INT_MAX);
        spinBox->setValue(mProperty.read(mObject.data()).toInt());
        editor = qobject_cast< QWidget* >(spinBox);
        connect(spinBox, SIGNAL(valueChanged(int)), SLOT(slotSpinBoxValueChanged()));

    } else if (mProperty.type() == QVariant::KeySequence) {

    } else if (mProperty.type() == QVariant::Line) {

    } else if (mProperty.type() == QVariant::LineF) {

    } else if (mProperty.type() == QVariant::List) {

    } else if (mProperty.type() == QVariant::Locale) {

    } else if (mProperty.type() == QVariant::LongLong) {
        QDoubleSpinBox *spinBox = new QDoubleSpinBox(parent());
        spinBox->setSingleStep(1.0);
        spinBox->setDecimals(0);
        spinBox->setMaximum(LONG_MAX);
        spinBox->setMinimum(LONG_MIN);
        spinBox->setValue(mProperty.read(mObject.data()).toLongLong());
        editor = qobject_cast< QWidget* >(spinBox);
        connect(spinBox, SIGNAL(valueChanged(int)), SLOT(slotDoubleSpinBoxValueChanged()));

    } else if (mProperty.type() == QVariant::Map) {

    } else if (mProperty.type() == QVariant::Matrix) {

    } else if (mProperty.type() == QVariant::Matrix4x4) {

    } else if (mProperty.type() == QVariant::Palette) {

    } else if (mProperty.type() == QVariant::Pen) {

    } else if (mProperty.type() == QVariant::Pixmap) {

    } else if (mProperty.type() == QVariant::Point) {

    } else if (mProperty.type() == QVariant::PointF) {

    } else if (mProperty.type() == QVariant::Polygon) {

    } else if (mProperty.type() == QVariant::Quaternion) {

    } else if (mProperty.type() == QVariant::Rect) {

    } else if (mProperty.type() == QVariant::RectF) {

    } else if (mProperty.type() == QVariant::RegExp) {

    } else if (mProperty.type() == QVariant::Region) {

    } else if (mProperty.type() == QVariant::Size) {

    } else if (mProperty.type() == QVariant::SizeF) {

    } else if (mProperty.type() == QVariant::SizePolicy) {

    } else if (mProperty.type() == QVariant::String) {
        QLineEdit *lineEdit = new QLineEdit(parent());
        lineEdit->setText(mProperty.read(mObject.data()).toString());
        editor = qobject_cast< QWidget* >(lineEdit);
        connect(lineEdit, SIGNAL(textChanged(QString)), SLOT(slotLineEditChanged()));

    } else if (mProperty.type() == QVariant::StringList) {

    } else if (mProperty.type() == QVariant::TextFormat) {

    } else if (mProperty.type() == QVariant::TextLength) {

    } else if (mProperty.type() == QVariant::Time) {

    } else if (mProperty.type() == QVariant::Transform) {

    } else if (mProperty.type() == QVariant::UInt) {
        QSpinBox *spinBox = new QSpinBox(parent());
        spinBox->setMaximum(UINT_MAX);
        spinBox->setMinimum(0);
        spinBox->setValue(mProperty.read(mObject.data()).toUInt());
        editor = qobject_cast< QWidget* >(spinBox);
        connect(spinBox, SIGNAL(valueChanged(int)), SLOT(slotSpinBoxValueChanged()));

    } else if (mProperty.type() == QVariant::ULongLong) {
        QDoubleSpinBox *spinBox = new QDoubleSpinBox(parent());
        spinBox->setSingleStep(1.0);
        spinBox->setDecimals(0);
        spinBox->setMinimum(0);
        spinBox->setMaximum(ULONG_MAX);
        spinBox->setValue(mProperty.read(mObject.data()).toULongLong());
        editor = qobject_cast< QWidget* >(spinBox);
        connect(spinBox, SIGNAL(valueChanged(int)), SLOT(slotDoubleSpinBoxValueChanged()));

    } else if (mProperty.type() == QVariant::Url) {
        QPushButton *button = new QPushButton(parent());
        QUrl url = mProperty.read(mObject.data()).toUrl();
        setButtonUrl(button, url);
        editor = qobject_cast< QWidget* >(button);
        connect(button, SIGNAL(clicked(bool)), SLOT(slotUrlButtonClicked()));

    } else if (mProperty.type() == QVariant::UserType) {

    } else if (mProperty.type() == QVariant::Vector2D) {

    } else if (mProperty.type() == QVariant::Vector3D) {

    } else if (mProperty.type() == QVariant::Vector4D) {

    }

    mWidget = editor;
}
예제 #8
0
void PropertiesEditorItem::slotPropertyValueChanged()
{
    if (mProperty.type() == QVariant::BitArray) {

    } else if (mProperty.type() == QVariant::Bitmap) {

    } else if (mProperty.type() == QVariant::Bool) {
        QCheckBox *checkBox = qobject_cast<QCheckBox*>(mWidget.data());
        checkBox->setChecked(mProperty.read(mObject.data()).toBool());

    } else if (mProperty.type() == QVariant::Brush) {

    } else if (mProperty.type() == QVariant::ByteArray) {

    } else if (mProperty.type() == QVariant::Char) {

    } else if (mProperty.type() == QVariant::Color) {

    } else if (mProperty.type() == QVariant::Cursor) {

    } else if (mProperty.type() == QVariant::Date) {

    } else if (mProperty.type() == QVariant::DateTime) {

    } else if (mProperty.type() == QVariant::Double) {
        QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(mWidget.data());
        spinBox->setValue(mProperty.read(mObject.data()).toDouble());

    } else if (mProperty.type() == QVariant::EasingCurve) {
        QPushButton *button = qobject_cast<QPushButton*>(mWidget.data());
        QEasingCurve curve = mProperty.read(mObject.data()).toEasingCurve();
        button->setText(curve.staticMetaObject.enumerator(0).valueToKey(curve.type()));

    } else if (mProperty.type() == QVariant::Font) {
        QFontComboBox *comboBox = qobject_cast<QFontComboBox*>(mWidget.data());
        comboBox->setCurrentFont(mProperty.read(mObject.data()).value<QFont>());

    } else if (mProperty.type() == QVariant::Hash) {

    } else if (mProperty.type() == QVariant::Icon) {

    } else if (mProperty.type() == QVariant::Image) {

    } else if (mProperty.type() == QVariant::Int) {
        QSpinBox *spinBox = qobject_cast<QSpinBox*>(mWidget.data());
        spinBox->setValue(mProperty.read(mObject.data()).toInt());

    } else if (mProperty.type() == QVariant::KeySequence) {

    } else if (mProperty.type() == QVariant::Line) {

    } else if (mProperty.type() == QVariant::LineF) {

    } else if (mProperty.type() == QVariant::List) {

    } else if (mProperty.type() == QVariant::Locale) {

    } else if (mProperty.type() == QVariant::LongLong) {
        QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(mWidget.data());
        spinBox->setValue(mProperty.read(mObject.data()).toLongLong());

    } else if (mProperty.type() == QVariant::Map) {

    } else if (mProperty.type() == QVariant::Matrix) {

    } else if (mProperty.type() == QVariant::Matrix4x4) {

    } else if (mProperty.type() == QVariant::Palette) {

    } else if (mProperty.type() == QVariant::Pen) {

    } else if (mProperty.type() == QVariant::Pixmap) {

    } else if (mProperty.type() == QVariant::Point) {

    } else if (mProperty.type() == QVariant::PointF) {

    } else if (mProperty.type() == QVariant::Polygon) {

    } else if (mProperty.type() == QVariant::Quaternion) {

    } else if (mProperty.type() == QVariant::Rect) {

    } else if (mProperty.type() == QVariant::RectF) {

    } else if (mProperty.type() == QVariant::RegExp) {

    } else if (mProperty.type() == QVariant::Region) {

    } else if (mProperty.type() == QVariant::Size) {

    } else if (mProperty.type() == QVariant::SizeF) {

    } else if (mProperty.type() == QVariant::SizePolicy) {

    } else if (mProperty.type() == QVariant::String) {
        QLineEdit *lineEdit = qobject_cast<QLineEdit*>(mWidget.data());
        lineEdit->setText(mProperty.read(mObject.data()).toString());

    } else if (mProperty.type() == QVariant::StringList) {

    } else if (mProperty.type() == QVariant::TextFormat) {

    } else if (mProperty.type() == QVariant::TextLength) {

    } else if (mProperty.type() == QVariant::Time) {

    } else if (mProperty.type() == QVariant::Transform) {

    } else if (mProperty.type() == QVariant::UInt) {
        QSpinBox *spinBox = qobject_cast<QSpinBox*>(mWidget.data());
        spinBox->setValue(mProperty.read(mObject.data()).toUInt());

    } else if (mProperty.type() == QVariant::ULongLong) {
        QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(mWidget.data());
        spinBox->setValue(mProperty.read(mObject.data()).toULongLong());

    } else if (mProperty.type() == QVariant::Url) {
        QPushButton *button = qobject_cast<QPushButton*>(mWidget.data());
        QUrl url = mProperty.read(mObject.data()).toUrl();
        setButtonUrl(button, url);

    } else if (mProperty.type() == QVariant::UserType) {

    } else if (mProperty.type() == QVariant::Vector2D) {

    } else if (mProperty.type() == QVariant::Vector3D) {

    } else if (mProperty.type() == QVariant::Vector4D) {

    }
}
예제 #9
0
void PropertiesEditorItem::slotFontComboChanged()
{
    QFontComboBox *comboBox = qobject_cast<QFontComboBox*>(mWidget.data());
    mProperty.write(mObject.data(), comboBox->font());
}