HistoryDockWidget::HistoryDockWidget(QWidget *parent, Qt::WindowFlags flags)
 : QDockWidget(parent, flags)
{
  setObjectName("History Dock Widget");
  setWindowTitle(_("Search History"));

  //QFrame *swatch = new ColorDock(colorName, this);
  //swatch->setFrameStyle(QFrame::Box | QFrame::Sunken);
  //setWidget(swatch);
//setFrameStyle(QFrame::Box | QFrame::Sunken);

  m_context_menu = new QMenu("Menu", this);
  QAction *action = m_context_menu->addAction(_("Raise"));
  connect(action, SIGNAL(triggered()), this, SLOT(raise()));
  m_context_menu->addAction(action);
  m_context_menu->addSeparator();

  connect(m_context_menu, SIGNAL(aboutToShow()), this, SLOT(updateContextMenu()));

  m_list = new QListWidget(this);
  m_list->setSortingEnabled(false);
  m_list->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  m_list->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);

  //QVBoxLayout *layout = new QVBoxLayout;
  //layout->addWidget(m_list);
  //setLayout(layout);
  setWidget(m_list);

  connect(m_list, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
          this,   SLOT(historyListItemDoubleClicked(QListWidgetItem *)));
}
Exemplo n.º 2
0
void EditorFrame::contextMenuEvent(QContextMenuEvent *event)
{
  if(!mModelExplorer->hasSelectedRows()){
    return;
  }

  if(mModelExplorer->classViewUnderMouse()){
    if(updateContextMenu(false)){
      mContextMenu->exec(event->globalPos());
    }
  }
  else if(mModelExplorer->treeViewUnderMouse()){
    if(updateContextMenu(true)){
      mContextMenu->exec(event->globalPos());
    }
  }
}
Exemplo n.º 3
0
void MapWidget::contextMenuEvent(QContextMenuEvent *event) {
	if ( _canvas.filterContextMenuEvent(event, this) ) return;

	QMenu menu(this);

	updateContextMenu(&menu);

	// Evaluation action performed
	executeContextMenuAction(menu.exec(event->globalPos()));
}
Exemplo n.º 4
0
void LLLocationInputCtrl::onTextEditorRightClicked(S32 x, S32 y, MASK mask)
{
	if (mLocationContextMenu)
	{
		updateContextMenu();
		mLocationContextMenu->buildDrawLabels();
		mLocationContextMenu->updateParent(LLMenuGL::sMenuContainer);
		hideList();
		setFocus(true);
		changeLocationPresentation();
		LLMenuGL::showPopup(this, mLocationContextMenu, x, y);
	}
}
Exemplo n.º 5
0
void ClipboardBrowser::setEditorWidget(ItemEditorWidget *editor, bool changeClipboard)
{
    bool active = editor != NULL;

    if (m_editor != editor) {
        m_editor = editor;
        if (active) {
            connect( editor, SIGNAL(destroyed()),
                     this, SLOT(onEditorDestroyed()) );
            connect( editor, SIGNAL(save()),
                     this, SLOT(onEditorSave()) );
            if (changeClipboard) {
                connect( editor, SIGNAL(save()),
                         this, SLOT(onEditorNeedsChangeClipboard()) );
            }
            connect( editor, SIGNAL(cancel()),
                     this, SLOT(onEditorCancel()) );
            connect( editor, SIGNAL(invalidate()),
                     editor, SLOT(deleteLater()) );
            updateEditorGeometry();
            editor->show();
            editor->setFocus();
            stopExpiring();
        } else {
            setFocus();
            if (isHidden())
                restartExpiring();
            if (m_invalidateCache)
                invalidateItemCache();
            if (m_expireAfterEditing)
                expire();
        }
    }

    setFocusProxy(m_editor);

    setAcceptDrops(!active);

    // Hide scrollbars while editing.
    Qt::ScrollBarPolicy scrollbarPolicy = Qt::ScrollBarAlwaysOff;
    if (!active) {
        const ConfigTabAppearance *appearance = ConfigurationManager::instance()->tabAppearance();
        scrollbarPolicy = appearance->themeValue("show_scrollbars").toBool()
                ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff;
    }
    setVerticalScrollBarPolicy(scrollbarPolicy);
    setHorizontalScrollBarPolicy(scrollbarPolicy);

    emit updateContextMenu();
}
Exemplo n.º 6
0
KrcdNotifierItem::KrcdNotifierItem(){
    setCategory(KStatusNotifierItem::Hardware);
    updateTray();
    setContextMenu(&m_menu);

    // No need for close button...
    setStandardActionsEnabled(false);
    setAssociatedWidget(&m_menu);
    updateContextMenu();
    QDBusConnection::sessionBus().connect(QLatin1String( "org.kde.kded" ), QLatin1String( "/modules/kremotecontroldaemon" ), QLatin1String( "org.kde.krcd" ), QLatin1String( "connectionChanged" ),  this, SLOT(updateTray()));
    QDBusConnection::sessionBus().connect(QLatin1String( "org.kde.kded" ), QLatin1String( "/modules/kremotecontroldaemon" ), QLatin1String( "org.kde.krcd" ), QLatin1String( "remoteControlAdded" ),  this, SLOT(updateTray()));
    QDBusConnection::sessionBus().connect(QLatin1String( "org.kde.kded" ), QLatin1String( "/modules/kremotecontroldaemon" ), QLatin1String( "org.kde.krcd" ), QLatin1String( "remoteControlAdded" ),  this, SLOT(updateContextMenu()));
    QDBusConnection::sessionBus().connect(QLatin1String( "org.kde.kded" ), QLatin1String( "/modules/kremotecontroldaemon" ), QLatin1String( "org.kde.krcd" ), QLatin1String( "remoteControlRemoved" ),  this, SLOT(updateTray()));
    QDBusConnection::sessionBus().connect(QLatin1String( "org.kde.kded" ), QLatin1String( "/modules/kremotecontroldaemon" ), QLatin1String( "org.kde.krcd" ), QLatin1String( "remoteControlRemoved" ),  this, SLOT(updateContextMenu()));
    QDBusConnection::sessionBus().connect(QLatin1String( "org.kde.kded" ), QLatin1String( "/modules/kremotecontroldaemon" ), QLatin1String( "org.kde.krcd" ), QLatin1String( "buttonPressed" ),  this, SLOT(flash()));
    QDBusConnection::sessionBus().connect(QLatin1String( "org.kde.kded" ), QLatin1String( "/modules/kremotecontroldaemon" ), QLatin1String( "org.kde.krcd" ), QLatin1String( "modeChanged" ),  this, SLOT(updateContextMenu()));
}