本文整理汇总了C++中QAction::parentWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::parentWidget方法的具体用法?C++ QAction::parentWidget怎么用?C++ QAction::parentWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::parentWidget方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
QWidget *QActionProto::parentWidget() const
{
QAction *item = qscriptvalue_cast<QAction*>(thisObject());
if (item)
return item->parentWidget();
return 0;
}
示例2: insertText
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());
}
示例3: convolutionDialog
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;
}
}
示例4: updateDescriptionMenuItem
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);
}
}
示例5: sendKeyEvent
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));
}
示例6: activeContextStateChanged
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();
}
}
}
}
示例7: contextMenu
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());
}
示例8: execute
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);
}
示例9: parentWidget
int Action::parentWidget(lua_State * L) // const : QWidget
{
QAction* obj = QtObject<QAction>::check( L, 1);
QtObject<QWidget>::create( L, obj->parentWidget());
return 1;
}