当前位置: 首页>>代码示例>>C++>>正文


C++ QAction::property方法代码示例

本文整理汇总了C++中QAction::property方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::property方法的具体用法?C++ QAction::property怎么用?C++ QAction::property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QAction的用法示例。


在下文中一共展示了QAction::property方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: event

bool GCF::ActionContainerWidget::event(QEvent* e)
{
    switch(e->type())
    {
    case QEvent::ActionAdded:
    {
        QActionEvent* ae = (QActionEvent*)e;
        QAction* action = ae->action();
        QWidget* actionWidget = 0;

        int row=-1, col=-1;
        int rowSpan = action->property("rowSpan").toInt();
        int colSpan = action->property("colSpan").toInt();
        if(!rowSpan)
            rowSpan = 1;
        if(!colSpan)
            colSpan = 1;
        if(rowSpan > d->maxRows)
            rowSpan = d->maxRows;

        actionWidget = createWidget(action, rowSpan, colSpan);

        d->gridLayout->findCell(rowSpan, colSpan, &row, &col);
        d->gridLayout->addWidget(actionWidget, row, col, rowSpan, colSpan, Qt::AlignJustify);

        d->actionWidgetMap[action] = actionWidget;
        action->setProperty("row", row);
        action->setProperty("col", col);

        actionWidget->show();

    }
    return true;

    case QEvent::ActionRemoved:
    {
        QActionEvent* ae = (QActionEvent*)e;
        QAction* action = ae->action();
        QWidget* actionWidget = d->actionWidgetMap.contains(action) ? d->actionWidgetMap[action] : 0;

        int row = action->property("row").toInt();
        int col = action->property("col").toInt();
        int rowSpan = action->property("rowSpan").toInt();
        int colSpan = action->property("colSpan").toInt();

        if(actionWidget && qobject_cast<QToolButton*>(actionWidget))
            delete actionWidget;

        d->actionWidgetMap.remove(action);
        d->gridLayout->markCells(false, row, col, rowSpan, colSpan);
    }
    return true;

    default:
        break;
    }

    return QWidget::event(e);
}
开发者ID:banduladh,项目名称:levelfour,代码行数:59,代码来源:ActionContainerWidget.cpp

示例2: actionResolution

void MainWindow::actionResolution(){
    QAction *action = (QAction*)sender();

    setWidth( action->property("width").toInt());
    setHeight(action->property("height").toInt());

    updateResolution();
}
开发者ID:apolunin,项目名称:gideros,代码行数:8,代码来源:mainwindow.cpp

示例3: onAction

void SettingsWindow::onAction()
{
    QAction *triggeredAction = static_cast<QAction*>(sender());
    foreach (QAction *action, ui->toolBar->actions())
        action->setIcon(action->property("iconNormal").value<QIcon>());
    triggeredAction->setIcon(triggeredAction->property("iconActive").value<QIcon>());
    ui->stackedWidget->slideInIdx(triggeredAction->property("page").toInt());
}
开发者ID:ArgelErx,项目名称:MediaElch,代码行数:8,代码来源:SettingsWindow.cpp

示例4: savePixmap

	void CustomWebView::savePixmap ()
	{
		QAction *action = qobject_cast<QAction*> (sender ());
		if (!action)
		{
			qWarning () << Q_FUNC_INFO
					<< "sender is not an action"
					<< sender ();
			return;
		}

		const QPixmap& px = action->property ("Poshuku/OrigPX").value<QPixmap> ();
		if (px.isNull ())
			return;

		const QUrl& url = action->property ("Poshuku/OrigURL").value<QUrl> ();
		const QString origName = url.scheme () == "data" ?
				QString () :
				QFileInfo (url.path ()).fileName ();

		QString filter;
		QString fname = QFileDialog::getSaveFileName (0,
				tr ("Save pixmap"),
				QDir::homePath () + '/' + origName,
				tr ("PNG image (*.png);;JPG image (*.jpg);;All files (*.*)"),
				&filter);

		if (fname.isEmpty ())
			return;

		if (QFileInfo (fname).suffix ().isEmpty ())
		{
			if (filter.contains ("png"))
				fname += ".png";
			else if (filter.contains ("jpg"))
				fname += ".jpg";
		}

		QFile file (fname);
		if (!file.open (QIODevice::WriteOnly))
		{
			emit gotEntity (Util::MakeNotification ("Poshuku",
						tr ("Unable to save the image. Unable to open file for writing: %1.")
							.arg (file.errorString ()),
						PCritical_));
			return;
		}

		const QString& suf = QFileInfo (fname).suffix ();
		const bool isLossless = suf.toLower () == "png";
		px.save (&file,
				suf.toUtf8 ().constData (),
				isLossless ? 0 : 100);
	}
开发者ID:Akon32,项目名称:leechcraft,代码行数:54,代码来源:customwebview.cpp

示例5: nextWallpaper

void TrayIcon::nextWallpaper()
{
    try
    {
        WallpaperResult result;
        QRect desktopSize = Desktop::GetSize();

        _trayIcon->setIcon(*_iconLoading);

        QAction *action = qobject_cast<QAction *>(sender());
        if (action && action->property("categoryIndex") != QVariant::Invalid)
        {
            int categoryIndex = action->property("categoryIndex").toInt();
            QList<SourceViewModel*> sources;
            sources.append(_settingsViewModel->GetSources()[categoryIndex]);

            result = _providersManager->DownloadRandomImage(
                    sources,
                    desktopSize.width(),
                    desktopSize.height());
        }
        else
        {
            result = _providersManager->DownloadRandomImage(
                    _settingsViewModel->GetSources(),
                    desktopSize.width(),
                    desktopSize.height());
        }

        if (result.image.length() > 0)
        {
            Desktop::SetWallpaper(result.image);
        }

        updateTrayIcon();

        _currentUrl = result.url;
        _currentDescription = result.urlDescription;
        _currentName = result.name;

        _trayIcon->showMessage(result.name,
                               result.urlDescription,
                               QSystemTrayIcon::Information, 4000);

        _timeCounter = 0;
        updateToolTip();
    }
    catch (...)
    {
    }
}
开发者ID:marek-g,项目名称:Tapeciarnia,代码行数:51,代码来源:TrayIcon.cpp

示例6: onCustomMenuHandler

void FilterExpressionToolBar::onCustomMenuHandler(const QPoint& pos)
{
    QAction * filterAction = actionAt(pos);
    if ( ! filterAction )
        return;

    QMenu * filterMenu = new QMenu(this);

    QAction *actFilter = filterMenu->addAction(tr("Filter Button Preferences..."));
    connect(actFilter, SIGNAL(triggered()), this, SLOT(toolBarShowPreferences()));
    actFilter->setProperty(dfe_property_label_, filterAction->property(dfe_property_label_));
    actFilter->setProperty(dfe_property_expression_, filterAction->property(dfe_property_expression_));
    actFilter->setData(filterAction->data());
    filterMenu->addSeparator();
    QAction * actEdit = filterMenu->addAction(tr("Edit"));
    connect(actEdit, SIGNAL(triggered()), this, SLOT(editFilter()));
    actEdit->setProperty(dfe_property_label_, filterAction->property(dfe_property_label_));
    actEdit->setProperty(dfe_property_expression_, filterAction->property(dfe_property_expression_));
    actEdit->setData(filterAction->data());
    QAction * actDisable = filterMenu->addAction(tr("Disable"));
    connect(actDisable, SIGNAL(triggered()), this, SLOT(disableFilter()));
    actDisable->setProperty(dfe_property_label_, filterAction->property(dfe_property_label_));
    actDisable->setProperty(dfe_property_expression_, filterAction->property(dfe_property_expression_));
    actDisable->setData(filterAction->data());
    QAction * actRemove = filterMenu->addAction(tr("Remove"));
    connect(actRemove, SIGNAL(triggered()), this, SLOT(removeFilter()));
    actRemove->setProperty(dfe_property_label_, filterAction->property(dfe_property_label_));
    actRemove->setProperty(dfe_property_expression_, filterAction->property(dfe_property_expression_));
    actRemove->setData(filterAction->data());

    filterMenu->exec(mapToGlobal(pos));
}
开发者ID:ljakab,项目名称:wireshark,代码行数:32,代码来源:filter_expression_toolbar.cpp

示例7: columnMenuChanged

void MainWindow::columnMenuChanged()
{
    QAction* action = static_cast<QAction*>(sender());

    if (action->isChecked())
    {
        QSettings().setValue(action->property("setting").toString(), true);
        ui->tableView->showColumn(action->property("columnIndex").toInt());
    }
    else
    {
        QSettings().setValue(action->property("setting").toString(), false);
        ui->tableView->hideColumn(action->property("columnIndex").toInt());
    }
}
开发者ID:DestroyFX,项目名称:EveLogLite,代码行数:15,代码来源:mainwindow.cpp

示例8: ChangeSceneCollection

void OBSBasic::ChangeSceneCollection()
{
	QAction *action = reinterpret_cast<QAction*>(sender());
	std::string fileName;

	if (!action)
		return;

	fileName = QT_TO_UTF8(action->property("fileName").value<QString>());
	if (fileName.empty())
		return;

	const char *oldName = config_get_string(App()->GlobalConfig(),
			"Basic", "SceneCollection");
	if (action->text().compare(QT_UTF8(oldName)) == 0) {
		action->setChecked(true);
		return;
	}

	SaveProjectNow();

	Load(fileName.c_str());
	RefreshSceneCollections();

	const char *newName = config_get_string(App()->GlobalConfig(),
			"Basic", "SceneCollection");
	const char *newFile = config_get_string(App()->GlobalConfig(),
			"Basic", "SceneCollectionFile");

	blog(LOG_INFO, "Switched to scene collection '%s' (%s.json)",
			newName, newFile);
	blog(LOG_INFO, "------------------------------------------------");

	UpdateTitleBar();
}
开发者ID:chewcode,项目名称:obs-studio,代码行数:35,代码来源:window-basic-main-scene-collections.cpp

示例9: actionScale

void MainWindow::actionScale(){
    QAction *action = (QAction*)sender();

    int scaleProperty = action->property("scale").toInt();
    int scaleCurrent = scale();

    switch(scaleProperty){
        case(eZoomIn):
            scaleProperty = scaleCurrent;
            ++scaleProperty;
            break;

        case(eZoomOut):
            scaleProperty = scaleCurrent;
            if(scaleProperty > 1)
                --scaleProperty;
            break;

        case(eFitToWindow):
            int width = scale() * ui.centralWidget->width() / ui.glCanvas->width();
            int height = scale() * ui.centralWidget->height() / ui.glCanvas->height();

            scaleProperty = std::min(width, height);
            break;
    }

    setScale(scaleProperty);

    updateResolution();
}
开发者ID:apolunin,项目名称:gideros,代码行数:30,代码来源:mainwindow.cpp

示例10: actionOrientation

void MainWindow::actionOrientation(){
    QAction *action = (QAction*)sender();

    setOrientation(static_cast<Orientation>(action->property("orientation").toInt()));

    updateOrientation();
}
开发者ID:apolunin,项目名称:gideros,代码行数:7,代码来源:mainwindow.cpp

示例11: actionFps

void MainWindow::actionFps(){
    QAction *action = (QAction*)sender();

    setFps(action->property("fps").toInt());

    updateFps();
}
开发者ID:apolunin,项目名称:gideros,代码行数:7,代码来源:mainwindow.cpp

示例12: updateSubscriptionAction

void MediaView::updateSubscriptionAction(Video *video, bool subscribed) {
    QAction *subscribeAction = MainWindow::instance()->getAction("subscribeChannel");

    QString subscribeTip;
    QString subscribeText;
    if (!video) {
        subscribeText = subscribeAction->property("originalText").toString();
        subscribeAction->setEnabled(false);
    } else if (subscribed) {
        subscribeText = tr("Unsubscribe from %1").arg(video->getChannelTitle());
        subscribeTip = subscribeText;
        subscribeAction->setEnabled(true);
    } else {
        subscribeText = tr("Subscribe to %1").arg(video->getChannelTitle());
        subscribeTip = subscribeText;
        subscribeAction->setEnabled(true);
    }
    subscribeAction->setText(subscribeText);
    subscribeAction->setStatusTip(subscribeTip);

    if (subscribed) {
        subscribeAction->setIcon(IconUtils::icon("bookmark-remove"));
    } else {
        subscribeAction->setIcon(IconUtils::icon("bookmark-new"));
    }

    MainWindow::instance()->setupAction(subscribeAction);
}
开发者ID:flaviotordini,项目名称:minitube,代码行数:28,代码来源:mediaview.cpp

示例13: sl_renameDataset

void DatasetsListWidget::sl_renameDataset() {
    GCOUNTER(cvar, tvar, "WD::Dataset::Rename Dataset");
    QAction *a = dynamic_cast<QAction*>(sender());
    CHECK(NULL != a, );

    int idx = a->property("idx").toInt();
    CHECK(idx < tabs->count(), );

    bool error = false;
    QString text = tabs->tabText(idx);
    do {
        bool ok = false;
        text = QInputDialog::getText(this,
            tr("Rename Dataset"),
            tr("New dataset name:"),
            QLineEdit::Normal,
            text, &ok);
        if (!ok) {
            return;
        }
        U2OpStatusImpl os;
        ctrl->renameDataset(idx, text, os);
        if (os.hasError()) {
            QMessageBox::critical(this, tr("Error"), os.getError());
        }
        error = os.hasError();
    } while (error);

    tabs->setTabText(idx, text);
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:30,代码来源:DatasetsListWidget.cpp

示例14: contextMenuEvent

void CSceneWidget::contextMenuEvent(QContextMenuEvent *event)
{
    if(QGraphicsItem *item = itemAt(event->pos()))
    {
        _currentItem = qgraphicsitem_cast<CGraphicsItem *>(item);
        if(!qFuzzyCompare(item->zValue(), qreal(0.0))) // ignore first item, first item is background
        {
            QListIterator<QAction *> it(_itemsMenu->actions());
            while(it.hasNext())
            {
                QAction *action = it.next();
                if(action->property("action").toString().compare("hidebox") == 0)
                {
                    action->setChecked(!_currentItem->isEditMode());
                    action->setText(_currentItem->isEditMode()?tr("Hide box"):tr("Show box"));
                    break;
                }
            }
            _itemsMenu->exec(event->globalPos());
        }
        else
        {
            _sceneMenu->exec(event->globalPos());
        }
    }

    _currentItem = 0;
    update();
}
开发者ID:slima4,项目名称:zgui-qt,代码行数:29,代码来源:scenewidget.cpp

示例15: updateAutoScale

void MainWindow::updateAutoScale(){
    if(autoScale()){
        ui.centralWidget->setMinimumSize(1, 1);

    }else{
        ui.centralWidget->setMinimumSize(0, 0);

        QAction *action = resolutionGroup_->checkedAction();
        if(action){
            setWidth(action->property("width").toInt());
            setHeight(action->property("height").toInt());
        }
    }

    resolutionGroup_->setEnabled(!autoScale());

    updateResolution();
}
开发者ID:apolunin,项目名称:gideros,代码行数:18,代码来源:mainwindow.cpp


注:本文中的QAction::property方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。