Example #1
0
QWidget *QActionProto::parentWidget() const
{
  QAction *item = qscriptvalue_cast<QAction*>(thisObject());
  if (item)
    return item->parentWidget();
  return 0;
}
void EditStringCell::insertText()
{
    QAction *menuItem = qobject_cast<QAction *>(sender());
    if (menuItem->parentWidget()->objectName() == kGenderNumberMenuName)
        ui.stringEdit->insertPlainText(menuItem->text().left(4));
    else
        ui.stringEdit->insertPlainText(menuItem->text());
}
Example #3
0
void MainWindow::convolutionDCTDialog()
{
	if (activeImageDisplay())
	{
		ConvolutionDialog convolutionDialog(this);

		connect(&convolutionDialog, SIGNAL(finalSelected(ImageDisplay *)),
		        this, SLOT(performConvolutionDCT(ImageDisplay *)));

		QImage currentImage = activeImageDisplay()->getImage();

		int imageHeight = currentImage.height();
		int imageWidth = currentImage.width();

		int newHeightAndWidth = ImageOperations::firstPowerOfTwoOfLargerDimension(imageWidth, imageHeight);
		int newHeight = newHeightAndWidth;
		int newWidth = newHeightAndWidth;

		QList<QAction*> list = windowActionGroup->actions();

		QList<QAction*>::const_iterator stlIter1;
		for ( stlIter1 = list.begin(); stlIter1 != list.end(); ++stlIter1 )
		{
			QAction* action = (*stlIter1);

			//QWidget * QAction::parentWidget ()
			QWidget *widget = action->parentWidget();
			ImageDisplay *imageDisplay = (ImageDisplay*) widget;

			if (activeImageDisplay() != imageDisplay)
			{
				QImage image = imageDisplay->getImage();

				int maskHeight = image.height();
				int maskWidth = image.width();

				if (newHeight > 0 && newWidth > 0 && maskHeight > 0 && maskWidth > 0 &&
				        newHeight == maskHeight && newWidth == maskWidth)
				{
					convolutionDialog.addSelectCandidate(imageDisplay);
				}
			}
		}

		convolutionDialog.defineTargetMaskSize(newHeight, newWidth);
		convolutionDialog.refreshComboBox();
		int result = convolutionDialog.exec();

		if (result == QDialog::Rejected)
			return;
	}
}
void TikzCommandInserter::updateDescriptionMenuItem()
{
	QAction *action = qobject_cast<QAction*>(sender());
	if (action)
	{
		const int num = action->data().toInt();
		const TikzCommand cmd = m_tikzCommandsList.at(num);
		QList<QAction*> menuActions = qobject_cast<QMenu*>(action->parentWidget())->actions();
		QString description = cmd.description;
		description.replace(QLatin1Char('&'), QLatin1String("&&")); // don't use ampersands in the description to create a keyboard accelerator
		menuActions[menuActions.size()-1]->setText(description);
		menuActions[menuActions.size()-1]->setData(cmd.number);
	}
}
void QSoftKeyManager::sendKeyEvent()
{
    Q_D(QSoftKeyManager);
    QAction *action = qobject_cast<QAction*>(sender());

    if (!action)
        return;

    Qt::Key keyToSend = d->keyedActions.value(action, Qt::Key_unknown);

    if (keyToSend != Qt::Key_unknown)
        QApplication::postEvent(action->parentWidget(),
                                new QKeyEvent(QEvent::KeyPress, keyToSend, Qt::NoModifier));
}
Example #6
0
void KviIrcContextDisplayAction::activeContextStateChanged()
{
	if(m_pActionList)
	{
		for(QAction * a = m_pActionList->first();a;a = m_pActionList->next())
		{
			QToolBar *t = (QToolBar*) a->parentWidget();
			if(t)
			{
				KviIrcContextDisplay * w = (KviIrcContextDisplay *) t->widgetForAction(a);
				if(w)
					w->update();
			}
		}
	}
}
void MashStepTableModel::contextMenu(const QPoint &point)
{
   QObject* calledBy = sender();
   QHeaderView* hView = qobject_cast<QHeaderView*>(calledBy);

   int selected = hView->logicalIndexAt(point);
   unitDisplay currentUnit;
   unitScale  currentScale;

   // Since we need to call generateVolumeMenu() two different ways, we need
   // to figure out the currentUnit and Scale here

   currentUnit  = displayUnit(selected);
   currentScale = displayScale(selected);

   QMenu* menu;
   QAction* invoked;

   switch(selected)
   {
      case MASHSTEPAMOUNTCOL:
         menu = Brewtarget::setupVolumeMenu(parentTableWidget,currentUnit, currentScale);
         break;
      case MASHSTEPTEMPCOL:
      case MASHSTEPTARGETTEMPCOL:
         menu = Brewtarget::setupTemperatureMenu(parentTableWidget,currentUnit);
         break;
      case MASHSTEPTIMECOL:
         menu = Brewtarget::setupTimeMenu(parentTableWidget,currentScale);
         break;
      default:
         return;
   }

   invoked = menu->exec(hView->mapToGlobal(point));
   if ( invoked == 0 )
      return;

   QWidget* pMenu = invoked->parentWidget();
   if ( pMenu == menu )
      setDisplayUnit(selected,(unitDisplay)invoked->data().toInt());
   else
      setDisplayScale(selected,(unitScale)invoked->data().toInt());
}
Example #8
0
  void execute() override {
    QAction *act = CommandManager::instance()->getAction(MI_LoadRecentImage);

    /*--- 右クリックで呼ばれないとここにWidgetが入らない ---*/
    FlipBook *flip = qobject_cast<FlipBook *>(act->parentWidget());
    if (!flip) return;

    DVMenuAction *menu = dynamic_cast<DVMenuAction *>(act->menu());
    int index          = menu->getTriggeredActionIndex();
    QString path =
        RecentFiles::instance()->getFilePath(index, RecentFiles::Flip);

    TFilePath fp(path.toStdWString());

    /*--- shrinkは1でロードする ---*/
    ::viewFile(fp, -1, -1, -1, 1, 0, flip, false);

    RecentFiles::instance()->moveFilePath(index, 0, RecentFiles::Flip);
  }
Example #9
0
int Action::parentWidget(lua_State * L) // const : QWidget
{
    QAction* obj = QtObject<QAction>::check( L, 1);
    QtObject<QWidget>::create( L, obj->parentWidget());
	return 1;
}