Example #1
0
void KTagsView::slotOpenContextMenu(const QPoint& /*ta*/)
{
  KTagListItem* item = dynamic_cast<KTagListItem*>(m_tagsList->currentItem());
  if (item) {
    slotSelectTag();
    emit openContextMenu(item->tag());
  }
}
Example #2
0
void KMyMoneyAccountTreeView::customContextMenuRequested(const QPoint &pos)
{
  Q_UNUSED(pos)
  QModelIndex index = model()->index(currentIndex().row(), AccountsModel::Account, currentIndex().parent());
  if (index.isValid() && (model()->flags(index) & Qt::ItemIsSelectable)) {
    QVariant data = model()->data(index, AccountsModel::AccountRole);
    if (data.isValid()) {
      if (data.canConvert<MyMoneyAccount>()) {
        emit selectObject(data.value<MyMoneyAccount>());
        emit openContextMenu(data.value<MyMoneyAccount>());
      }
      if (data.canConvert<MyMoneyInstitution>()) {
        emit selectObject(data.value<MyMoneyInstitution>());
        emit openContextMenu(data.value<MyMoneyInstitution>());
      }
    }
  }
}
bool ClassEditor::onTreeViewButtonRelease(GdkEventButton* ev, Gtk::TreeView* view)
{
	// Single click with RMB (==> open context menu)
	if (ev->button == 3)
	{
		openContextMenu(view);
	}

	return false;
}
// ---
void VSWSCDynContentDataListTree::keyReleaseEvent (QKeyEvent* evnt)
{
	QModelIndexList selected = selectedIndexes ();
	QModelIndexList::iterator i = selected.begin ();
	if (i == selected.end ()) 
	{
		QTreeView::keyReleaseEvent (evnt); 
		// None has been selected, then it is sent to the parent...
		return;
	}

	// When a button is released, 
	// then depending on the button one or other thing is done...
	QModelIndex index = *i;
	VSWSCDynContentDataListModel::Item* item = 
		static_cast <VSWSCDynContentDataListModel::Item*> (index.internalPointer ());
	evnt -> accept(); // But in any case, the event is just treated...
	if (item -> type () == 4) // Button works just for dynamic content...
	{
		// What ever the key selected is...
		// The information has to be highlighted
		QTreeView::keyReleaseEvent (evnt); // Default treatment...
		emit (dynContentSelectedSignal (
			item -> parent () -> parent () -> parent () -> parent () -> value (), 
			item -> parent () -> parent () -> parent () -> value (), 
			item -> parent () -> parent () -> value (),
			item -> parent () -> value ())); // ...the data in the right side has to change...
		emit (detailDataSelectedSignal ()); // It is a very detail data...

		// Now depending on the key, the menu will be one or other...
		switch ((int) evnt -> key ())
		{
			// The alt graphics key is used to access to the internal options of the element...
			case Qt::Key_Control:
				QTreeView::keyReleaseEvent (evnt); // Default treatement...
				// The menu will be open where the cursor is...
				// So just in case and just because customer is using here the keyboard
				// The cursor is placed in the middle of the selected item
				// Before launching the openContentMenu method...
				QCursor::setPos (mapToGlobal (QPoint (0,0)) + visualRect (index).center ());
				openContextMenu (item); 
				break;

			// The enter key is just to select a player and to access to the internal data...
			// But just going over the element it is also selected, just in the case it is a player
			case Qt::Key_Return:
			case Qt::Key_Enter:
			default:
				QTreeView::keyReleaseEvent (evnt); // Default treatement...
				break;
		}
	}
	else
		emit (noDetailDataSelectedSignal ());
}
Example #5
0
/**
 * Catch the right click press
 */
 void KBinaryClock::mousePressEvent(QMouseEvent *event) {
	switch (event->button()) {
		case QMouseEvent::RightButton:
			QToolTip::remove(this);
			openContextMenu();
			break;
		case QMouseEvent::LeftButton:
			toggleCalendar();
			QToolTip::remove(this);
			break;
		case QMouseEvent::MidButton:
			QToolTip::remove(this);
			break;
		default:
			break;
	}
}
Example #6
0
void MainWindow::initSignals(QObject *ctrl, QObject *dvctrl)
{
	/* slots & signals: GUI only */
	connect(docksButton, SIGNAL(clicked()),
	        this, SLOT(openContextMenu()));

	//	we decided to remove this functionality for now
	//	connect(bandDock, SIGNAL(topLevelChanged(bool)),
	//			this, SLOT(reshapeDock(bool)));

	/* buttons to alter label display dynamics */
	connect(ignoreButton, SIGNAL(toggled(bool)),
	        markButton, SLOT(setDisabled(bool)));
	connect(ignoreButton, SIGNAL(toggled(bool)),
	        nonmarkButton, SLOT(setDisabled(bool)));

	connect(ignoreButton, SIGNAL(toggled(bool)),
	        ctrl, SIGNAL(toggleIgnoreLabels(bool)));

	// label manipulation from current dist_view
	connect(addButton, SIGNAL(clicked()),
	        dvctrl, SLOT(addHighlightToLabel()));
	connect(remButton, SIGNAL(clicked()),
	        dvctrl, SLOT(remHighlightFromLabel()));

	connect(markButton, SIGNAL(toggled(bool)),
	        dvctrl, SIGNAL(toggleLabeled(bool)));
	connect(nonmarkButton, SIGNAL(toggled(bool)),
	        dvctrl, SIGNAL(toggleUnlabeled(bool)));

	//	connect(chief2, SIGNAL(normTargetChanged(bool)),
	//			this, SLOT(normTargetChanged(bool)));

	subscriptionsDebugButton->hide();

	connect(subscriptionsDebugButton, SIGNAL(clicked()),
	        ctrl, SLOT(debugSubscriptions()));

	/// global shortcuts
	QShortcut *scr = new QShortcut(Qt::CTRL + Qt::Key_S, this);
	connect(scr, SIGNAL(activated()), this, SLOT(screenshot()));
}
Example #7
0
void BuddyListNode::actionOpenContextMenu()
{
  openContextMenu();
}
// ---
void VSWSCDynContentDataListTree::mouseReleaseEvent (QMouseEvent* evnt)
{
	QModelIndexList selected = selectedIndexes ();
	QModelIndexList::iterator i = selected.begin (); // The action is only allowed with just one item...first?
	if (i == selected.end ()) 
	{
		QTreeView::mouseReleaseEvent (evnt); 
		// None has been selected, then it is sent to the parent...
		return;
	}

	// When a button is statistic, 
	// then depending on the button one or other thing is done...
	QModelIndex index = *i;
	VSWSCDynContentDataListModel::Item* item = 
		static_cast <VSWSCDynContentDataListModel::Item*> (index.internalPointer ());
	evnt -> accept(); // But in any case, the event is considers as just treated...
	if (item -> type () == 4) // Button works just only for dynamic content...
	{
		emit (detailDataSelectedSignal ()); // It is a very detail data...
		switch (evnt -> button ())
		{
			// With the right button, the context menu is then opened...
			// ...and just when the type of item select is some data of the dynamic content.
			case Qt::RightButton:
				QTreeView::mouseReleaseEvent (evnt); // Default treatement just in case...
				emit (dynContentSelectedSignal (
					item -> parent () -> parent () -> parent () -> parent () -> value (), 
					item -> parent () -> parent () -> parent () -> value (), 
					item -> parent () -> parent () -> value (),
					item -> parent () -> value ())); // ...the data in the right siode has to change...
				openContextMenu (item); 
				break;

			// Left button implies to select an statistic
			// and to access to the detail data of it...
			case Qt::LeftButton:
				QTreeView::mouseReleaseEvent (evnt); // Default treatment just in case...
				emit (dynContentSelectedSignal (
					item -> parent () -> parent () -> parent () -> parent () -> value (), 
					item -> parent () -> parent () -> parent () -> value (), 
					item -> parent () -> parent () -> value (),
					item -> parent () -> value ())); // ...the data in the right siode has to change...
				break;

			// Any other behaviour...
			default:
				QTreeView::mouseReleaseEvent (evnt); // Default treatment just in case...
				break; // Nothing to do...Option not possible, just to perfect code!.
		}
	}
	else
	{
		emit (noDetailDataSelectedSignal ());
		switch (evnt -> button ())
		{
			// With the right button, the context menu is then opened...
			// ...and just when the type of item select is some data of the dynamic content.
			case Qt::RightButton:
				QTreeView::mouseReleaseEvent (evnt); // Default treatement just in case...
				openContextMenu (item); 
				break;
		}
	}
}