本文整理汇总了C++中setContextMenuPolicy函数的典型用法代码示例。如果您正苦于以下问题:C++ setContextMenuPolicy函数的具体用法?C++ setContextMenuPolicy怎么用?C++ setContextMenuPolicy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setContextMenuPolicy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QTreeWidget
QueueListView::QueueListView(QWidget* parent)
: QTreeWidget(parent), d(new QueueListViewPriv)
{
setIconSize(QSize(d->iconSize, d->iconSize));
setSelectionMode(QAbstractItemView::ExtendedSelection);
setWhatsThis(i18n("This is the list of images to batch process."));
setAcceptDrops(true);
viewport()->setAcceptDrops(true);
setDropIndicatorShown(true);
setDragEnabled(true);
viewport()->setMouseTracking(true);
setSortingEnabled(false);
setAllColumnsShowFocus(true);
setRootIsDecorated(false);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setColumnCount(3);
setContextMenuPolicy(Qt::CustomContextMenu);
QStringList titles;
titles.append(i18n("Thumbnail"));
titles.append(i18n("File Name"));
titles.append(i18n("Target"));
setHeaderLabels(titles);
header()->setResizeMode(0, QHeaderView::ResizeToContents);
header()->setResizeMode(1, QHeaderView::Stretch);
header()->setResizeMode(2, QHeaderView::Stretch);
d->toolTip = new QueueToolTip(this);
d->toolTipTimer = new QTimer(this);
// -----------------------------------------------------------
connect(DatabaseAccess::databaseWatch(), SIGNAL(collectionImageChange(const CollectionImageChangeset&)),
this, SLOT(slotCollectionImageChange(const CollectionImageChangeset&)),
Qt::QueuedConnection);
connect(d->thumbLoadThread, SIGNAL(signalThumbnailLoaded(const LoadingDescription&, const QPixmap&)),
this, SLOT(slotThumbnailLoaded(const LoadingDescription&, const QPixmap&)));
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT(slotContextMenu()));
connect(d->toolTipTimer, SIGNAL(timeout()),
this, SLOT(slotToolTip()));
}
示例2: m_machineState
/* Constructor: */
UIVMPreviewWindow::UIVMPreviewWindow(QWidget *pParent)
: QIWithRetranslateUI<QWidget>(pParent)
, m_machineState(KMachineState_Null)
, m_pUpdateTimer(new QTimer(this))
, m_vMargin(10)
, m_pbgImage(0)
, m_pPreviewImg(0)
, m_pGlossyImg(0)
{
/* Setup contents: */
setContentsMargins(0, 5, 0, 5);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
/* Create session instance: */
m_session.createInstance(CLSID_Session);
/* Create the context menu: */
setContextMenuPolicy(Qt::DefaultContextMenu);
m_pUpdateTimerMenu = new QMenu(this);
QActionGroup *pUpdateTimeG = new QActionGroup(this);
pUpdateTimeG->setExclusive(true);
for(int i = 0; i < UpdateInterval_Max; ++i)
{
QAction *pUpdateTime = new QAction(pUpdateTimeG);
pUpdateTime->setData(i);
pUpdateTime->setCheckable(true);
pUpdateTimeG->addAction(pUpdateTime);
m_pUpdateTimerMenu->addAction(pUpdateTime);
m_actions[static_cast<UpdateInterval>(i)] = pUpdateTime;
}
m_pUpdateTimerMenu->insertSeparator(m_actions[static_cast<UpdateInterval>(UpdateInterval_500ms)]);
/* Load preview update interval: */
QString strInterval = vboxGlobal().virtualBox().GetExtraData(GUI_PreviewUpdate);
/* Parse loaded value: */
UpdateInterval interval = m_intervals.key(strInterval, UpdateInterval_1000ms);
/* Initialize with the new update interval: */
setUpdateInterval(interval, false);
/* Setup connections: */
connect(m_pUpdateTimer, SIGNAL(timeout()), this, SLOT(sltRecreatePreview()));
connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)),
this, SLOT(sltMachineStateChange(QString, KMachineState)));
/* Retranslate the UI */
retranslateUi();
}
示例3: DragWidget
ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_currentWidget(0)
{
QGridLayout *layout = new QGridLayout(this);
layout->setMargin(0);
layout->setContentsMargins(1, 1, 1, 1);
layout->setSpacing(0);
m_toolButton = new QToolButton(this);
m_toolButton->setAutoRaise(false);
m_toolButton->setIcon(style()->standardIcon(QStyle::SP_DockWidgetCloseButton));
m_toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
m_toolButton->setFixedSize(16, 16);
m_toolButton->setToolTip(tr("Hides this toolbar."));
connect(m_toolButton, SIGNAL(clicked()), this, SLOT(onTogglePane()));
layout->addWidget(m_toolButton, 0, 0, 1, 1);
colorDialog();
QWidget *fontWidget = createFontWidget();
m_currentWidget = fontWidget;
QWidget *imageWidget = createImageWidget();
QWidget *borderImageWidget = createBorderImageWidget();
QWidget *rectangleWidget = createRectangleWidget();
QWidget *easingWidget = createEasingWidget();
layout->addWidget(fontWidget, 0, 1, 2, 1);
layout->addWidget(easingWidget, 0, 1, 2, 1);
layout->addWidget(imageWidget, 0, 1, 2, 1);
layout->addWidget(borderImageWidget, 0, 1, 2, 1);
layout->addWidget(rectangleWidget, 0, 1, 2, 1);
setAutoFillBackground(true);
setContextMenuPolicy(Qt::ActionsContextMenu);
m_resetAction = new QAction(tr("Pin Toolbar"), this);
m_resetAction->setCheckable(true);
addAction(m_resetAction.data());
connect(m_resetAction.data(), SIGNAL(triggered(bool)), this, SLOT(onResetPosition(bool)));
m_disableAction = new QAction(tr("Show Always"), this);
addAction(m_disableAction.data());
m_disableAction->setCheckable(true);
connect(m_disableAction.data(), SIGNAL(toggled(bool)), this, SLOT(onDisable(bool)));
m_pinned = false;
#ifdef Q_WS_MAC
setCursor(Qt::ArrowCursor);
#endif
}
示例4: QMainWindow
MainWindow::MainWindow(const QString &defaultDisplay, QSplashScreen *splash, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
_qpd(NULL), _kcpos(0), _defaultDisplay(defaultDisplay),
_silent(false), _allowSilent(false), _splash(splash), _settings(NULL),
_activatedEth(false), _numInstalledOS(0), _netaccess(NULL), _displayModeBox(NULL)
{
ui->setupUi(this);
setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
setContextMenuPolicy(Qt::NoContextMenu);
update_window_title();
_kc << 0x01000013 << 0x01000013 << 0x01000015 << 0x01000015 << 0x01000012
<< 0x01000014 << 0x01000012 << 0x01000014 << 0x42 << 0x41;
ui->list->setItemDelegate(new TwoIconsDelegate(this));
ui->list->installEventFilter(this);
ui->advToolBar->setVisible(false);
QRect s = QApplication::desktop()->screenGeometry();
if (s.height() < 500)
resize(s.width()-10, s.height()-100);
if (qApp->arguments().contains("-runinstaller") && !_partInited)
{
QMessageBox::warning(this,
tr("Confirm"),
tr("Warning: setting up SD card."),
QMessageBox::Yes, QMessageBox::No);
/* Repartition SD card first */
_partInited = true;
setEnabled(false);
_qpd = new QProgressDialog( tr("Setting up SD card"), QString(), 0, 0, this);
_qpd->setWindowModality(Qt::WindowModal);
_qpd->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
InitDriveThread *idt = new InitDriveThread(this);
connect(idt, SIGNAL(statusUpdate(QString)), _qpd, SLOT(setLabelText(QString)));
connect(idt, SIGNAL(completed()), _qpd, SLOT(deleteLater()));
connect(idt, SIGNAL(error(QString)), this, SLOT(onError(QString)));
connect(idt, SIGNAL(query(QString, QString, QMessageBox::StandardButton*)),
this, SLOT(onQuery(QString, QString, QMessageBox::StandardButton*)),
Qt::BlockingQueuedConnection);
idt->start();
_qpd->exec();
setEnabled(true);
}
示例5: QWidget
MainWindow::MainWindow(QWidget *parent)
: QWidget(parent, Qt::FramelessWindowHint |
Qt::WindowSystemMenuHint |
Qt::WindowStaysOnTopHint),
dragPosition(),
worker_thread_(NULL),
gui_update_thread_(this),
logo_rotation_timer(NULL)
{
setWindowTitle("Loudness Drop");
setMinimumSize(130, 130);
setMaximumSize(0, 0);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QAction *quitAction = new QAction(tr("E&xit"), this);
quitAction->setShortcut(tr("Ctrl+Q"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
addAction(quitAction);
setContextMenuPolicy(Qt::ActionsContextMenu);
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(0);
layout->setSpacing(0);
render_area_ = new RenderArea;
progress_bar_ = new QProgressBar;
progress_bar_->setFixedHeight(15);
progress_bar_->setMaximum(130);
progress_bar_->setTextVisible(false);
layout->addWidget(render_area_);
layout->addWidget(progress_bar_);
setLayout(layout);
setAcceptDrops(true);
connect(&gui_update_thread_, SIGNAL(setProgressBar(int)),
this, SLOT(setProgressBar(int)));
connect(&gui_update_thread_, SIGNAL(rotateLogo()),
this, SLOT(rotateLogo()));
connect(&gui_update_thread_, SIGNAL(resetLogo()),
this, SLOT(resetLogo()));
connect(this, SIGNAL(stopGUIThread()),
&gui_update_thread_, SLOT(stopThread()));
gui_update_thread_.start();
}
示例6: QListView
FileSystemBrowser::FileSystemBrowser(QWidget *parent) :
QListView(parent)
{
fileSysModel = new QFileSystemModel;
fileSysModel->setFilter(QDir::AllEntries);
fileSysModel->setRootPath(QDir::currentPath());
fileSysModel->sort(0,Qt::AscendingOrder);
setModel(fileSysModel);
setRootIndex(fileSysModel->index(QDir::currentPath()));
viewport()->installEventFilter(this);
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(doubleClickedItem(QModelIndex)));
connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(customMenu(QPoint)));
}
示例7: QListView
ListView::ListView(QWidget *parent)
: QListView(parent)
, eventFilter(nullptr)
, menu(nullptr)
, zoomLevel(1.0)
{
setDragEnabled(true);
setContextMenuPolicy(Qt::NoContextMenu);
setDragDropMode(QAbstractItemView::DragOnly);
setSelectionMode(QAbstractItemView::ExtendedSelection);
setAlternatingRowColors(false);
setUniformItemSizes(true);
setAttribute(Qt::WA_MouseTracking);
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(showCustomContextMenu(const QPoint &)));
connect(this, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(checkDoubleClick(const QModelIndex &)));
}
示例8: QListView
ConditionWidget::ConditionWidget(ComplexCondition* condition, QWidget *parent) :
QListView(parent)
{
mModel = new QStandardItemModel(this);
setModel(mModel);
setEditTriggers(QAbstractItemView::NoEditTriggers);
setItemDelegate(new ConditionWidgetDelegate(this));
setCondition(condition);
setContextMenuPolicy(Qt::ActionsContextMenu);
mSelectedCondition = 0;
QAction* deleteAction = new QAction(QIcon(":/media/delete.png"), tr("Delete"), this);
deleteAction->setShortcut(QKeySequence::Delete);
deleteAction->setShortcutContext(Qt::WidgetShortcut);
addAction(deleteAction);
connect(deleteAction, SIGNAL(triggered()), this, SLOT(onDeleteTriggered()));
}
示例9: QAbstractConfigurableTileWidget
QIntConfigurableTileWidget::QIntConfigurableTileWidget(Configurable* config, Configurable::paramkey& key, QMap<QGridPos, QAbstractConfigurableTileWidget*>& tileIndexConfigWidgetMap) :
QAbstractConfigurableTileWidget(config, key, tileIndexConfigWidgetMap), origBounds(config->getParamintBounds(key)), origValue(config->getParam(key)), stopSignaling(false) {
int minBound = config->getParamintBounds(key).first;
int maxBound = config->getParamintBounds(key).second;
int value = config->getParam(key);
QString key_name = QString(key.c_str());
QString toolTipName = QString(config->getParamDescr(key).c_str());
QString toolTipVals = "min=" + QString::number(minBound) + ", max=" + QString::number(maxBound);
setLayout(&gridLayoutConfigurableTile);
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(sl_execContextMenu(const QPoint &)));
lName.setText(key_name);
lName.setToolTip(toolTipName);
lName.setFont(QFont("Arial Narrow", 10, QFont::Normal));
lName.setWordWrap(true);
//lName.setMaximumWidth(QAbstractConfigurableTileWidget::widgetSize.width() - 150);
spBox.setAcceptDrops(false);
spBox.setFixedWidth(80);
spBox.setMinimum(minBound);
spBox.setMaximum(maxBound);
spBox.setToolTip(toolTipVals);
spBox.setValue(value);
spBox.setSingleStep(1);
spBox.setFont(QFont("Courier", 11, QFont::Normal));
slider.setOrientation(Qt::Horizontal);
slider.setMinimum(minBound);
slider.setMaximum(maxBound);
slider.setValue(value);
slider.setToolTip(toolTipVals);
gridLayoutConfigurableTile.addWidget(&lName, 0, 0, 1, 2, Qt::AlignLeft);
gridLayoutConfigurableTile.addWidget(&spBox, 0, 2);
gridLayoutConfigurableTile.addWidget(&slider, 1, 0, 1, 3);
connect(&slider, SIGNAL(valueChanged(int)), this, SLOT(sl_sliderValueChanged(int)));
connect(&spBox, SIGNAL(valueChanged(int)), this, SLOT(sl_spinBoxValueChanged(int)));
setBackgroundRole(QPalette::Background);
setAutoFillBackground(true);
}
示例10: QWidget
//! [0]
ShapedClock::ShapedClock(QWidget *parent)
: QWidget(parent, Qt::FramelessWindowHint | Qt::WindowSystemMenuHint)
{
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
timer->start(1000);
QAction *quitAction = new QAction(tr("E&xit"), this);
quitAction->setShortcut(tr("Ctrl+Q"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
addAction(quitAction);
setContextMenuPolicy(Qt::ActionsContextMenu);
setToolTip(tr("Drag the clock with the left mouse button.\n"
"Use the right mouse button to open a context menu."));
setWindowTitle(tr("Shaped Analog Clock"));
}
示例11: QTabBar
TabBar::TabBar(QWidget *parent)
: QTabBar(parent)
{
TRACE_OBJ
#ifdef Q_OS_MAC
setDocumentMode(true);
#endif
setMovable(true);
setShape(QTabBar::RoundedNorth);
setContextMenuPolicy(Qt::CustomContextMenu);
setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred,
QSizePolicy::TabWidget));
connect(this, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int)));
connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(slotTabCloseRequested(int)));
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this,
SLOT(slotCustomContextMenuRequested(QPoint)));
}
示例12: QScrollArea
PreviewWidget::PreviewWidget(QWidget * parent): QScrollArea(parent){
setBackgroundRole(QPalette::Base);
mCenter = ConfigManagerInterface::getInstance()->getOption("Preview/PreviewPanelCenter", true).toBool();
mFit = ConfigManagerInterface::getInstance()->getOption("Preview/PreviewPanelFit", false).toBool();
preViewer = new QLabel(this);
preViewer->setBackgroundRole(QPalette::Base);
preViewer->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
preViewer->setScaledContents(true);
preViewer->setContextMenuPolicy(Qt::CustomContextMenu);
connect(preViewer,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenu(QPoint)));
connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenu(QPoint)));
setContextMenuPolicy(Qt::CustomContextMenu);
setWidget(preViewer);
}
示例13: QMenu
void QQuestionsTableWidget::initMenu()
{
QAction * action;
menu = new QMenu(this);
action = menu -> addAction(QIcon(":/images/plus.png"),tr("Добавить вопрос"));
action -> setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
action -> setShortcutContext(Qt::WidgetShortcut);
connect(action,SIGNAL(triggered()),this,SLOT(addQuestionRow()));
action = menu -> addAction(QIcon(":/images/minus.png"),tr("Удалить вопрос"));
action -> setShortcut(QKeySequence(Qt::Key_Delete));
action -> setShortcutContext(Qt::WidgetShortcut);
connect(action,SIGNAL(triggered()),this,SLOT(deleteQuestionRow()));
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(menuPopUp()));
}
示例14: QTabWidget
ReferenceManager::ReferenceManager(QWidget* parent) : QTabWidget(parent)
{
setMovable(true);
setTabsClosable(true);
mCurrentReferenceView = 0;
//Close All Tabs
mCloseAllTabs = new QPushButton(this);
mCloseAllTabs->setIcon(DIcon("close-all-tabs.png"));
mCloseAllTabs->setToolTip(tr("Close All Tabs"));
connect(mCloseAllTabs, SIGNAL(clicked()), this, SLOT(closeAllTabs()));
setCornerWidget(mCloseAllTabs, Qt::TopLeftCorner);
setContextMenuPolicy(Qt::CustomContextMenu);
connect(Bridge::getBridge(), SIGNAL(referenceInitialize(QString)), this, SLOT(newReferenceView(QString)));
connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
}
示例15: QWebView
EmbeddedWebView::EmbeddedWebView(QWidget *parent, QNetworkAccessManager *networkManager):
QWebView(parent), m_scrollParent(0L), m_resizeInProgress(0)
{
// set to expanding, ie. "freely" - this is important so the widget will attempt to shrink below the sizehint!
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setFocusPolicy(Qt::StrongFocus); // not by the wheel
setPage(new ErrorCheckingPage(this));
page()->setNetworkAccessManager(networkManager);
QWebSettings *s = settings();
s->setAttribute(QWebSettings::JavascriptEnabled, false);
s->setAttribute(QWebSettings::JavaEnabled, false);
s->setAttribute(QWebSettings::PluginsEnabled, false);
s->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
s->setAttribute(QWebSettings::JavaEnabled, false);
s->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, false);
s->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, false);
s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, false);
s->clearMemoryCaches();
page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
connect(this, SIGNAL(linkClicked(QUrl)), this, SLOT(slotLinkClicked(QUrl)));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(handlePageLoadFinished()));
connect(page()->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(handlePageLoadFinished()));
// Scrolling is implemented on upper layers
page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
// Setup shortcuts for standard actions
QAction *copyAction = page()->action(QWebPage::Copy);
copyAction->setShortcut(tr("Ctrl+C"));
addAction(copyAction);
// Redmine#3, the QWebView uses black text color when rendering stuff on dark background
QPalette palette = QApplication::palette();
if (palette.background().color().lightness() < 50) {
QStyle *style = QStyleFactory::create(QLatin1String("windows"));
Q_ASSERT(style);
palette = style->standardPalette();
setPalette(palette);
}
setContextMenuPolicy(Qt::NoContextMenu);
findScrollParent();
}