当前位置: 首页>>代码示例>>C++>>正文


C++ Global::confirmDeletes方法代码示例

本文整理汇总了C++中Global::confirmDeletes方法的典型用法代码示例。如果您正苦于以下问题:C++ Global::confirmDeletes方法的具体用法?C++ Global::confirmDeletes怎么用?C++ Global::confirmDeletes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Global的用法示例。


在下文中一共展示了Global::confirmDeletes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: deleteRequested

// Delete an item from the tree.  We really just hide it.
void NTagView::deleteRequested() {
    QList<QTreeWidgetItem*> items = selectedItems();

    qint32 lid = items[0]->data(NAME_POSITION, Qt::UserRole).toInt();
    if (global.confirmDeletes()) {
        QMessageBox msgBox;
        msgBox.setIcon(QMessageBox::Question);
        msgBox.setText(tr("Are you sure you want to delete this tag?"));
        msgBox.setWindowTitle(tr("Verify Delete"));
        msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
        msgBox.setDefaultButton(QMessageBox::No);
        int ret = msgBox.exec();
        if (ret == QMessageBox::No)
            return;
    }
    TagTable table(global.db);
    table.deleteTag(lid);
//    NTagViewItem *ptr = (NTagViewItem*)items[0];
//    ptr->setHidden(true);

    // Now remove it in the datastore
    NTagViewItem *ptr = dataStore.take(items[0]->data(NAME_POSITION, Qt::UserRole).toInt());
    emit(tagDeleted(lid, ptr->data(NAME_POSITION, Qt::DisplayRole).toString()));
    delete ptr;
}
开发者ID:turbochad,项目名称:Nixnote2,代码行数:26,代码来源:ntagview.cpp

示例2: deleteRequested

// Delete an item from the tree.  We really just hide it.
void NTagView::deleteRequested() {
    QList<QTreeWidgetItem*> items = selectedItems();

    if (global.confirmDeletes()) {
        QMessageBox msgBox;
        msgBox.setIcon(QMessageBox::Question);
        if (items.size() == 1)
            msgBox.setText(tr("Are you sure you want to delete this tag?"));
        else
            msgBox.setText(tr("Are you sure you want to delete all selected tags?"));
        msgBox.setWindowTitle(tr("Verify Delete"));
        msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
        msgBox.setDefaultButton(QMessageBox::No);
        int ret = msgBox.exec();
        if (ret == QMessageBox::No)
            return;
    }

    for (int i=0; i<items.size(); i++) {
        // Delete from the DB
        qint32 lid = items[i]->data(NAME_POSITION, Qt::UserRole).toInt();
        TagTable table(global.db);
        table.deleteTag(lid);

        // Now remove selected tags
        NTagViewItem *ptr = dataStore.take(items[i]->data(NAME_POSITION, Qt::UserRole).toInt());
        QList<QTreeWidgetItem*> children = ptr->takeChildren();
        ptr->parent()->addChildren(children);
        ptr->parent()->removeChild(ptr);
        emit(tagDeleted(lid, ptr->data(NAME_POSITION, Qt::DisplayRole).toString()));
        delete ptr;
    }
}
开发者ID:JelF,项目名称:nixnote2,代码行数:34,代码来源:ntagview.cpp

示例3: deleteRequested

// Remove one of the favorites.  Any children will be removed automatically
void FavoritesView::deleteRequested() {
    QList<QTreeWidgetItem*> items = selectedItems();

    if (items[0] == root)
        return;

    qint32 lid = items[0]->data(NAME_POSITION, Qt::UserRole).toInt();
    if (global.confirmDeletes()) {
        QMessageBox msgBox;
        msgBox.setIcon(QMessageBox::Question);
        msgBox.setText(tr("Are you sure you want to remove this shortcut?"));
        msgBox.setWindowTitle(tr("Verify Delete"));
        msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
        msgBox.setDefaultButton(QMessageBox::No);
        int ret = msgBox.exec();
        if (ret == QMessageBox::No)
            return;
    }
    FavoritesTable s(global.db);
    s.expunge(lid);
    items[0]->setHidden(true);
    for (int i=items[0]->childCount()-1; i>=0; i--) {
        FavoritesViewItem *child = (FavoritesViewItem*)items[0]->child(i);
        child->setHidden(true);
        child->parent()->removeChild(child);
        child = dataStore.take(child->record.lid);
        if (child != NULL) {
            targetStore.remove(child->record.target.toInt());
            delete child;
        }
    }
    FavoritesViewItem *parent = (FavoritesViewItem*)items[0]->parent();
    parent->removeChild(items[0]);
    FavoritesViewItem *item = dataStore.take(lid);
    if (item != NULL) {
        targetStore.remove(item->record.target.toInt());
        delete item;
     }
    if (parent != root) {
        if (parent->childCount() == 0) {
            root->removeChild(parent);
            parent = dataStore.take(parent->record.lid);
            if (parent != NULL) {
                targetStore.remove(parent->record.target.toInt());
                delete parent;
            }
        }
    }
    resetSize();
}
开发者ID:AustinPowered,项目名称:Nixnote2,代码行数:51,代码来源:favoritesview.cpp

示例4: deleteRequested

void NNotebookView::deleteRequested() {
    QList<QTreeWidgetItem*> items = selectedItems();

    qint32 lid = items[0]->data(NAME_POSITION, Qt::UserRole).toInt();
    if (global.confirmDeletes()) {
        QMessageBox msgBox;
        msgBox.setIcon(QMessageBox::Question);
        msgBox.setText(tr("Are you sure you want to delete this notebook?"));
        msgBox.setWindowTitle(tr("Verify Delete"));
        msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
        msgBox.setDefaultButton(QMessageBox::No);
        int ret = msgBox.exec();
        if (ret == QMessageBox::No)
            return;
    }
    NotebookTable table(global.db);
    table.deleteNotebook(lid);
    items[0]->setHidden(true);
    dataStore.remove(lid);
    emit(notebookDeleted(lid, items[0]->data(NAME_POSITION, Qt::UserRole).toString()));
}
开发者ID:BigOz,项目名称:Nixnote2,代码行数:21,代码来源:nnotebookview.cpp

示例5: QWidget

AppearancePreferences::AppearancePreferences(QWidget *parent) :
    QWidget(parent)
{
    mainLayout = new QGridLayout();
    mainLayout->setAlignment(Qt::AlignTop);
    setLayout(mainLayout);
    int middleClickIndex = global.getMiddleClickAction();

    showTrayIcon = new QCheckBox(tr("Show tray icon"), this);
    showPDFs = new QCheckBox(tr("Display PDFs inline"), this);
    showSplashScreen = new QCheckBox(tr("Show splash screen on startup"), this);
    autoStart = new QCheckBox(tr("Start automatically at login"), this);
    confirmDeletes = new QCheckBox(tr("Confirm Deletes"), this);
    showMissedReminders = new QCheckBox(tr("Show missed reminders on startup"), this);
    startMinimized = new QCheckBox(tr("Always Start minimized"), this);
    dynamicTotals = new QCheckBox(tr("Show notebook and tag totals"), this);
    autoHideEditorButtonbar = new QCheckBox(tr("Auto-Hide editor toolbar"), this);
    autoHideEditorButtonbar->setChecked(global.autoHideEditorToolbar);
    disableEditingOnStartup = new QCheckBox(tr("Disable note editing on statup"), this);
    newNoteFocusOnTitle = new QCheckBox(tr("Focus on Note Title on New Note"), this);
    forceWebFonts = new QCheckBox(tr("Limit Editor to Web Fonts*"), this);
    forceWebFonts->setChecked(global.forceWebFonts);

    traySingleClickAction = new QComboBox();
    traySingleClickAction->addItem(tr("Show/Hide NixNote"), 0);
    traySingleClickAction->addItem(tr("New Text Note"), 1);
    traySingleClickAction->addItem(tr("New Quick Note"), 2);
    traySingleClickAction->addItem(tr("Screen Capture"), 3);

    trayMiddleClickAction = new QComboBox();
    trayMiddleClickAction->addItem(tr("Show/Hide NixNote"), 0);
    trayMiddleClickAction->addItem(tr("New Text Note"), 1);
    trayMiddleClickAction->addItem(tr("New Quick Note"), 2);
    trayMiddleClickAction->addItem(tr("Screen Capture"), 3);

    mouseMiddleClickAction = new QComboBox();
    mouseMiddleClickAction->addItem(tr("Open New Tab"), MOUSE_MIDDLE_CLICK_NEW_TAB);
    mouseMiddleClickAction->addItem(tr("Open New Window"), MOUSE_MIDDLE_CLICK_NEW_WINDOW);
    mouseMiddleClickAction->setCurrentIndex(middleClickIndex);


    defaultGuiFontSizeChooser = new QComboBox();
    defaultFontChooser = new QComboBox();
    defaultFontSizeChooser = new QComboBox();
    connect(defaultFontChooser, SIGNAL(currentIndexChanged(QString)), this, SLOT(loadFontSizes(QString)));
    loadFontNames(defaultFontChooser, global.defaultFont);

    defaultGuiFontChooser = new QComboBox();
    connect(defaultGuiFontChooser, SIGNAL(currentIndexChanged(QString)), this, SLOT(loadGuiFontSizes(QString)));
    loadFontNames(defaultGuiFontChooser, global.defaultGuiFont);

    systemNotifier = new QComboBox();
    systemNotifier->addItem(tr("Qt Default"), "qt");
    systemNotifier->addItem(tr("notify-send"), "notify-send");

    windowThemeChooser = new QComboBox();
    windowThemeChooser->addItem(tr("System Default"));
    windowThemeChooser->addItems(global.getThemeNames());


    defaultNotebookOnStartupLabel = new QLabel(tr("Startup Behavior"),this);
    defaultNotebookOnStartup = new QComboBox();
    defaultNotebookOnStartup->addItem(tr("Restore Selection Criteria"), UseLastViewedNotebook);
    defaultNotebookOnStartup->addItem(tr("Select Default Notebook"), UseDefaultNotebook);
    defaultNotebookOnStartup->addItem(tr("View All Notebooks"), UseAllNotebooks);

    confirmDeletes->setChecked(global.confirmDeletes());

    int row=0;
    minimizeToTray = NULL;
    closeToTray = NULL;
    mainLayout->addWidget(showTrayIcon,row,0);
    mainLayout->addWidget(showSplashScreen, row++,1);
    if (QSystemTrayIcon::isSystemTrayAvailable()) {
        minimizeToTray = new QCheckBox(tr("Minimize to tray"));
        closeToTray = new QCheckBox(tr("Close to tray"));
        mainLayout->addWidget(minimizeToTray, row, 0);
        mainLayout->addWidget(closeToTray, row++, 1);
    }
    mainLayout->addWidget(autoHideEditorButtonbar, row, 0);
    mainLayout->addWidget(showPDFs, row++, 1);
    mainLayout->addWidget(showMissedReminders, row, 0);
    mainLayout->addWidget(dynamicTotals, row++, 1);
    mainLayout->addWidget(startMinimized, row, 0);
    mainLayout->addWidget(autoStart, row++, 1);
    mainLayout->addWidget(disableEditingOnStartup, row, 0);
    mainLayout->addWidget(newNoteFocusOnTitle, row++, 1);
    mainLayout->addWidget(confirmDeletes, row, 0);
    mainLayout->addWidget(forceWebFonts, row++, 1);

    mainLayout->addWidget(defaultNotebookOnStartupLabel,row,0);
    mainLayout->addWidget(defaultNotebookOnStartup, row++,1);

    mainLayout->addWidget(new QLabel(tr("Notification Service")), row, 0);
    mainLayout->addWidget(systemNotifier, row++, 1);

    mainLayout->addWidget(new QLabel(tr("Middle Click Open Behavior")), row,0);
    mainLayout->addWidget(mouseMiddleClickAction, row++, 1);

    mainLayout->addWidget(new QLabel(tr("Tray Icon Click Action")), row, 0);
//.........这里部分代码省略.........
开发者ID:BigOz,项目名称:Nixnote2,代码行数:101,代码来源:appearancepreferences.cpp


注:本文中的Global::confirmDeletes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。