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


C++ QSignalMapper类代码示例

本文整理汇总了C++中QSignalMapper的典型用法代码示例。如果您正苦于以下问题:C++ QSignalMapper类的具体用法?C++ QSignalMapper怎么用?C++ QSignalMapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Py_INCREF

static PyObject *meth_QSignalMapper_setMapping(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        QObject* a0;
        int a1;
        QSignalMapper *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ8i", &sipSelf, sipType_QSignalMapper, &sipCpp, sipType_QObject, &a0, &a1))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp->setMapping(a0,a1);
            Py_END_ALLOW_THREADS

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    {
        QObject* a0;
        const QString* a1;
        int a1State = 0;
        QSignalMapper *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ8J1", &sipSelf, sipType_QSignalMapper, &sipCpp, sipType_QObject, &a0, sipType_QString,&a1, &a1State))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp->setMapping(a0,*a1);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast<QString *>(a1),sipType_QString,a1State);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    {
        QObject* a0;
        QWidget* a1;
        QSignalMapper *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ8J8", &sipSelf, sipType_QSignalMapper, &sipCpp, sipType_QObject, &a0, sipType_QWidget, &a1))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp->setMapping(a0,a1);
            Py_END_ALLOW_THREADS

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    {
        QObject* a0;
        QObject* a1;
        QSignalMapper *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ8J8", &sipSelf, sipType_QSignalMapper, &sipCpp, sipType_QObject, &a0, sipType_QObject, &a1))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp->setMapping(a0,a1);
            Py_END_ALLOW_THREADS

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QSignalMapper, sipName_setMapping, doc_QSignalMapper_setMapping);

    return NULL;
}
开发者ID:annelida,项目名称:stuff,代码行数:75,代码来源:sipQtCoreQSignalMapper.cpp

示例2: QSignalMapper

void RfxDialog::DrawIFace(QGridLayout *parent, RfxUniform *u, int uidx, int rows, int columns)
{
	enum controlType { INT_CTRL, FLOAT_CTRL, BOOL_CTRL, COLOR_CTRL };
	enum ColorComponentsType { R, G, B, A };
	float *val = u->GetValue();
	controlType ctrl;
	ColorComponentsType rgba = R;
	QWidget **controls = new QWidget*[rows * columns];
	QGridLayout *uniLayout = parent;
	QHBoxLayout *sliderEditLayout = NULL;
	bool multipleControls = false;
	QSignalMapper *valMapper = new QSignalMapper(this);

	switch (u->GetType()) {
	case RfxUniform::INT:
	case RfxUniform::IVEC2:
	case RfxUniform::IVEC3:
	case RfxUniform::IVEC4:
		ctrl = INT_CTRL;
		break;

	case RfxUniform::FLOAT:
	case RfxUniform::VEC2:
	case RfxUniform::VEC3:
	case RfxUniform::VEC4:
		if(u->isRmColorVariable()){
			ctrl = COLOR_CTRL;
			break;
		}
	case RfxUniform::MAT2:
	case RfxUniform::MAT3:
	case RfxUniform::MAT4:
		ctrl = FLOAT_CTRL;
		break;

	case RfxUniform::BOOL:
	case RfxUniform::BVEC2:
	case RfxUniform::BVEC3:
	case RfxUniform::BVEC4:
		ctrl = BOOL_CTRL;
		break;

	default:
		return;
	}
	if(ctrl == COLOR_CTRL)
	{
		RfxColorBox* mycolorBox = new RfxColorBox(100, 25, QColor(val[0] * 255, val[1] * 255, val[2] * 255, val[3] * 255));
		uniLayout->addWidget(mycolorBox, 0,0);
		connect(mycolorBox, SIGNAL(colorChanged()), valMapper, SLOT(map()));
		connect(mycolorBox,SIGNAL(colorChanged()),mGLWin, SLOT(update()));
		valMapper->setMapping(mycolorBox,
			                      QString().setNum(uidx) + '-' +
			                      QString().setNum(1)  + '-' +
			                      QString().setNum(selPass));
	}
	else{
	// controls in a grid layout
	for (int i = 0; i < rows; ++i) {
		for (int j = 0; j < columns; ++j) {
			int arrayIdx = j + (i * rows);
			switch (ctrl) {
			case INT_CTRL:
				controls[arrayIdx] = new QSpinBox(this);
				((QSpinBox*)controls[arrayIdx])->setRange(-99, 99);
				((QSpinBox*)controls[arrayIdx])->setValue((int)val[arrayIdx]);
				connect(controls[arrayIdx], SIGNAL(valueChanged(int)),
				        valMapper, SLOT(map()));
				connect(controls[arrayIdx], SIGNAL(valueChanged(int)), this,
				        SLOT(extendRange(int)));
				break;
			case FLOAT_CTRL:
				if (u->HasMinMax()) {
					controls[arrayIdx] = new QSlider(this);
					((QSlider*)controls[arrayIdx])->setTickPosition(QSlider::NoTicks);
					((QSlider*)controls[arrayIdx])->setOrientation(Qt::Horizontal);

					// since qslider only deals with integers, do a little conversion
					// of values
					// keep as much as 5 decimal values, others will be lost in conversion
					int valAsInt = (int)(val[arrayIdx] * DECTOINT);
					int tickAsInt = (int)(((u->GetMaxRange() - u->GetMinRange()) * 0.01) * DECTOINT);

					((QSlider*)controls[arrayIdx])->setTickInterval(tickAsInt);
					((QSlider*)controls[arrayIdx])->setRange((int)(u->GetMinRange() * DECTOINT),
					                                         (int)(u->GetMaxRange() * DECTOINT));
					((QSlider*)controls[arrayIdx])->setValue(valAsInt);
					((QSlider*)controls[arrayIdx])->setToolTip(QString().setNum(val[arrayIdx]));

					connect(controls[arrayIdx], SIGNAL(valueChanged(int)), valMapper, SLOT(map()));

					// as per request, if value is a single float, also show a qlineedit to allow
					// more accurate settings.
					if (u->GetType() == RfxUniform::FLOAT) {

						QLineEdit *slideValue = new QLineEdit();
						slideValue->setAlignment(Qt::AlignRight);
						slideValue->setText(QString().setNum(val[arrayIdx]));

						QSignalMapper *yaMapper = new QSignalMapper();
//.........这里部分代码省略.........
开发者ID:Jerdak,项目名称:meshlab,代码行数:101,代码来源:rfx_dialog.cpp

示例3: QDialog

StartDialog::StartDialog(MainWindow &mainWindow, ProjectManager &projectManager)
		: QDialog(&mainWindow, false)
		, mMainWindow(mainWindow)
		, mProjectManager(projectManager)
{
	setMinimumSize(mMinimumSize);
	setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

	QTabWidget *tabWidget = new QTabWidget;

	RecentProjectsListWidget *recentProjects = new RecentProjectsListWidget(this);
	tabWidget->addTab(recentProjects, tr("&Recent projects"));

	Id const theOnlyDiagram = mMainWindow.editorManager().theOnlyDiagram();
	if (theOnlyDiagram.isNull()) {
		SuggestToCreateDiagramWidget *diagrams = new SuggestToCreateDiagramWidget(&mMainWindow, this);
		tabWidget->addTab(diagrams, tr("&New project with diagram"));
		connect(diagrams, SIGNAL(userDataSelected(QString)), this, SLOT(createProjectWithDiagram(QString)));
		if (recentProjects->count() == 0) {
			tabWidget->setCurrentWidget(diagrams);
		}
	}

	QCommandLinkButton *openIDLink = new QCommandLinkButton(tr("&Open interpreted diagram"));
	QCommandLinkButton *createIDLink = new QCommandLinkButton(tr("&Create interpreted diagram"));

	QHBoxLayout *openIDLinkLayout = new QHBoxLayout;
	openIDLinkLayout->addWidget(openIDLink);
	mInterpreterButton = openIDLink;

	QHBoxLayout *createIDLinkLayout = new QHBoxLayout;
	createIDLinkLayout->addWidget(createIDLink);
	mCreateInterpreterButton = createIDLink;

	QHBoxLayout *commandLinksLayout = new QHBoxLayout;

	if (theOnlyDiagram != Id()) {
		Id const editor = mMainWindow.editorManager().editors()[0];
		QString const diagramIdString = mMainWindow.editorManager().diagramNodeNameString(editor, theOnlyDiagram);

		QSignalMapper *newProjectMapper = new QSignalMapper(this);
		QCommandLinkButton *newLink = createCommandButton(tr("New project")
				, newProjectMapper, SLOT(map()), QKeySequence::New);
		newProjectMapper->setMapping(newLink, diagramIdString);
		connect(newProjectMapper, SIGNAL(mapped(QString)), this, SLOT(createProjectWithDiagram(QString)));
		commandLinksLayout->addWidget(newLink);
	}

	commandLinksLayout->addWidget(createCommandButton(tr("Open existing project")
			, this, SLOT(openExistingProject()), QKeySequence::Open));

	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addWidget(tabWidget);
	mainLayout->addLayout(openIDLinkLayout);
	mainLayout->addLayout(createIDLinkLayout);
	mainLayout->addLayout(commandLinksLayout);

	setLayout(mainLayout);
	setWindowTitle(tr("Start page"));

	connect(openIDLink, SIGNAL(clicked()), this, SLOT(openInterpretedDiagram()));
	connect(createIDLink, SIGNAL(clicked()), this, SLOT(createInterpretedDiagram()));

	connect(recentProjects, SIGNAL(userDataSelected(QString)), this, SLOT(openRecentProject(QString)));
	connect(this, SIGNAL(rejected()), this, SLOT(exitApp()));
}
开发者ID:Esenin,项目名称:qreal,代码行数:66,代码来源:startDialog.cpp

示例4: QMainWindow

TumblerWindow::TumblerWindow(TumblerStruct *xtum, bool rgba,
            bool doubleBuffer, bool enableDepth, QWidget * parent,
            const char * name, Qt::WindowFlags f)
  : QMainWindow(parent, f)
{
  int j;
  QString str;
  mTum = xtum;
  setAttribute(Qt::WA_DeleteOnClose);
  setAttribute(Qt::WA_AlwaysShowToolTips);

  if (firstTime) 
    utilFileListsToIcons(fileList, icons, MAX_XTUM_TOGGLES);
  firstTime = 0;
  
  // Make central vbox and top frame containing an hboxlayout
  QWidget *central = new QWidget(this);
  setCentralWidget(central);
  QVBoxLayout *cenlay = new QVBoxLayout(central);
  cenlay->setContentsMargins(0,0,0,0);
  cenlay->setSpacing(0);
  QFrame * topFrame = new QFrame(central);
  cenlay->addWidget(topFrame);
  topFrame->setFrameStyle(QFrame::Raised | QFrame::StyledPanel);

  QHBoxLayout *topLayout = new QHBoxLayout(topFrame);
  topLayout->setContentsMargins(2,2,2,2);
  topLayout->setSpacing(3);
  
  QVBoxLayout *topVBox = diaVBoxLayout(topLayout);
  topVBox->setSpacing(4);
  QHBoxLayout *topHBox = diaHBoxLayout(topVBox);
  topHBox->setContentsMargins(0,0,0,0);
  topHBox->setSpacing(3);

  // Add the toolbar widgets
  // Zoom spin box
  // If you try to make a spin box narrower, it makes the arrows tiny
  mZoomBox = (QSpinBox *)diaLabeledSpin(0, 1., XTUM_MAX_ZOOM, 1., "Zoom",
                                        topFrame, topHBox);
  mZoomBox->setValue(xtum->zoom);
  connect(mZoomBox, SIGNAL(valueChanged(int)), this, 
	  SLOT(zoomChanged(int)));
  mZoomBox->setToolTip("Change zoom of display");

  // Make the 2 toggle buttons and their signal mapper
  QSignalMapper *toggleMapper = new QSignalMapper(topFrame);
  connect(toggleMapper, SIGNAL(mapped(int)), this, SLOT(toggleClicked(int)));
  for (j = 0; j < 2; j++) {
    utilSetupToggleButton(topFrame, NULL, topHBox, toggleMapper, icons, 
                          toggleTips, mToggleButs, mToggleStates, j);
    connect(mToggleButs[j], SIGNAL(clicked()), toggleMapper, SLOT(map()));
  }

  // Help button
  mHelpButton = diaPushButton("Help", topFrame, topHBox);
  connect(mHelpButton, SIGNAL(clicked()), this, SLOT(help()));
  setFontDependentWidths();

  topHBox->addStretch();

  // Make second row for size spin boxes, and signal map them
  QHBoxLayout *botHBox = diaHBoxLayout(topVBox);
  botHBox->setContentsMargins(0,0,0,0);
  botHBox->setSpacing(3);
  QSignalMapper *sizeMapper = new QSignalMapper(topFrame);
  connect(sizeMapper, SIGNAL(mapped(int)), this, SLOT(sizeChanged(int)));

  // Make the spin boxes
  for (j = 0; j < 3; j++) {
    str = xyzLabels[j];
    mSizeBoxes[j] = (QSpinBox *)diaLabeledSpin(0, XTUM_SIZE_MIN, XTUM_SIZE_MAX,
                                               XTUM_SIZE_INC, LATIN1(str), 
                                               topFrame, botHBox);
    mSizeBoxes[j]->setValue(XTUM_SIZE_INI);
    sizeMapper->setMapping(mSizeBoxes[j], j);
    connect(mSizeBoxes[j], SIGNAL(valueChanged(int)), sizeMapper, SLOT(map()));
    mSizeBoxes[j]->setToolTip("Change size of box in " + str);
  }

  // Spacer for the second row
  botHBox->addStretch();

  // Add a vertical line
  QFrame *vertLine = new QFrame(topFrame);
  vertLine->setFrameStyle(QFrame::Sunken | QFrame::VLine);
  topLayout->addWidget(vertLine);

  // Threshold sliders
  mSliders = new MultiSlider(topFrame, 2, sliderLabels);
  topLayout->addLayout(mSliders->getLayout());
  connect(mSliders, SIGNAL(sliderChanged(int, int, bool)), this, 
	  SLOT(thresholdChanged(int, int, bool)));
  mSliders->setValue(0, xtum->minval);
  mSliders->setValue(1, xtum->maxval);
  mSliders->getSlider(0)->setToolTip(
		"Level below which pixels will be set to black");
  mSliders->getSlider(1)->setToolTip(
		"Level above which pixels will be set to white");

//.........这里部分代码省略.........
开发者ID:imod-mirror,项目名称:IMOD,代码行数:101,代码来源:xtum.cpp

示例5: QWidget


//.........这里部分代码省略.........

	FlowLayout *layQt = new FlowLayout;
	QStringList formatsQt;
	formatsQt << ".bmp" << ".gif" << ".tif" << ".tiff" << ".jpeg2000" << ".jpeg" << ".jpg" << ".png" << ".pbm" << ".pgm" << ".ppm" << ".xbm" << ".xpm";
	formatsQt.sort();
	for(int i = 0; i < formatsQt.length(); ++i) {

		SettingsTabOtherFileTypesTiles *check = new SettingsTabOtherFileTypesTiles(formatsQt.at(i));
		check->setToolTip(formatsQt.at(i));
		allCheckQt.insert(formatsQt.at(i),check);
		layQt->addWidget(check);

	}

	QHBoxLayout *layQtBut = new QHBoxLayout;
	CustomLabel *extraQt = new CustomLabel(tr("Extra File Types:"));
	extraQt->setWordWrap(false);
	extraQtEdit = new CustomLineEdit;
	CustomPushButton *qtMarkAll = new CustomPushButton(tr("Mark All"));
	CustomPushButton *qtMarkNone = new CustomPushButton(tr("Mark None"));
	layQtBut->addWidget(extraQt);
	layQtBut->addWidget(extraQtEdit);
	layQtBut->addStretch();
	layQtBut->addWidget(qtMarkAll);
	layQtBut->addWidget(qtMarkNone);

	layFile->addWidget(titleQt);
	layFile->addSpacing(10);
	layFile->addLayout(layQt);
	layFile->addSpacing(5);
	layFile->addLayout(layQtBut);
	layFile->addSpacing(35);

	QSignalMapper *mapQtMark = new QSignalMapper;
	mapQtMark->setMapping(qtMarkAll,"qtMark");
	connect(qtMarkAll, SIGNAL(clicked()), mapQtMark, SLOT(map()));
	connect(mapQtMark, SIGNAL(mapped(QString)), this, SLOT(markAllNone(QString)));

	QSignalMapper *mapQtNone = new QSignalMapper;
	mapQtNone->setMapping(qtMarkNone,"qtNone");
	connect(qtMarkNone, SIGNAL(clicked()), mapQtNone, SLOT(map()));
	connect(mapQtNone, SIGNAL(mapped(QString)), this, SLOT(markAllNone(QString)));

#ifndef GM
	CustomLabel *gmDisabled = new CustomLabel("<b><i>" + tr("Use of GraphicsMagick has been disabled as PhotoQt was compiled/installed!") + "</i></b>");
	gmDisabled->setWordWrap(true);
#endif

	CustomLabel *titleGmWorking = new CustomLabel("<b><span style=\"font-size:12pt\">" + tr("File Types - GraphicsMagick") + "</span></b><br><br>" + tr("PhotoQt makes use of GraphicsMagick for support of many different file types. Not all of the formats supported by GraphicsMagick make sense in an image viewer. There are some that aren't quite working at the moment, you can find them in the 'Unstable' category below.") + "<br>" + tr("If you want to add a file type not in the list, you can add them in the text box below. You have to enter the formats like '*.ending', all seperated by commas.") + "</b>");
	titleGmWorking->setWordWrap(true);

	FlowLayout *layGm = new FlowLayout;
	QStringList formatsGm;
	formatsGm << ".art" << ".avs" << ".x" << ".cals" << ".cgm" << ".cur" << ".cut" << ".acr" << ".dcm" << ".dicom" << ".dic" << ".dcx" << ".dib" << ".dpx" << ".emf" << ".epdf" << ".epi" << ".eps" << ".eps2" << ".eps3" << ".epsf" << ".epsi" << ".ept" << ".fax" << ".fig" << ".fits" << ".fts" << ".fit" << ".fpx" << ".gplt" << ".ico" << ".jbg" << ".jbig" << ".jng" << ".jp2" << ".j2k" << ".jpf" << ".jpx" << ".jpm" << ".mj2" << ".jpc" << ".mat" << ".miff" << ".mng" << ".mpc" << ".mtv" << ".otb" << ".p7" << ".palm" << ".pam" << ".pcd" << ".pcds" << ".pcx" << ".pdb" << ".pdf" << ".picon" << ".pict" << ".pct" << ".pic" << ".pix" << ".pnm" << ".ps" << ".ps2" << ".ps3" << ".psd" << ".ptif" << ".ras" << ".rast" << ".rad" << ".sgi" << ".sun" << ".svg" << ".tga" << ".vicar" << ".viff" << ".wbmp" << ".wbm" << ".xcf" << ".xwd";
	formatsGm.sort();
	for(int i = 0; i < formatsGm.length(); ++i) {

		SettingsTabOtherFileTypesTiles *check = new SettingsTabOtherFileTypesTiles(formatsGm.at(i));
		allCheckGm.insert(formatsGm.at(i),check);
		check->setToolTip(formatsGm.at(i));
		layGm->addWidget(check);
#ifndef GM
		check->setEnabled(false);
#endif

	}
开发者ID:jG0D,项目名称:groundstation,代码行数:67,代码来源:settingstabother.cpp

示例6: indexAt

void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
{
    QModelIndex index = indexAt(e->pos());
    if (index.isValid())
    {
        bool multipleSelection = false;
        mSelectionModel = selectionModel();
        if (mSelectionModel->selectedRows().count() > 1)
            multipleSelection = true;

        mContextItem = mModel.itemFromIndex(index);

        //Create a new context menu
        QMenu menu(this);

        //Store all applications in a list
        QList<QAction*> actions;

        //Create a signal mapper so we don't have to store data to class
        //member variables
        QSignalMapper *signalMapper = new QSignalMapper(this);

        if (mContextItem && mApplications->GetApplicationCount() > 0 && mContextItem->parent())
        {
            //Go through all applications and add them to the context menu
            for (int i = 0; i < mApplications->GetApplicationCount(); i++)
            {
                //Create an action for the application
                const Application app = mApplications->GetApplication(i);
                QAction *start = new QAction(app.getName(), &menu);
                if (multipleSelection)
                    start->setDisabled(true);

                //Add it to our list so we can disconnect later on
                actions << start;

                //Add it to context menu
                menu.addAction(start);

                //Connect the signal to signal mapper
                connect(start, SIGNAL(triggered()), signalMapper, SLOT(map()));

                //Add a new mapping
                signalMapper->setMapping(start, i);
            }

            connect(signalMapper, SIGNAL(mapped(int)),
                    this, SLOT(Context(int)));
        }

        // Add menuitems to copy full path/filename to clipboard
        if (mContextItem)
        {
            if (mApplications->GetApplicationCount() > 0)
            {
                menu.addSeparator();
            }

            //Create an action for the application
            QAction *copyfilename 	= new QAction(tr("Copy filename"), &menu);
            QAction *copypath 		= new QAction(tr("Copy full path"), &menu);
            QAction *copymessage 	= new QAction(tr("Copy message"), &menu);
            QAction *hide        	= new QAction(tr("Hide"), &menu);

            if (multipleSelection)
            {
                copyfilename->setDisabled(true);
                copypath->setDisabled(true);
                copymessage->setDisabled(true);
            }

            menu.addAction(copyfilename);
            menu.addAction(copypath);
            menu.addAction(copymessage);
            menu.addAction(hide);

            connect(copyfilename, SIGNAL(triggered()), this, SLOT(CopyFilename()));
            connect(copypath, SIGNAL(triggered()), this, SLOT(CopyFullPath()));
            connect(copymessage, SIGNAL(triggered()), this, SLOT(CopyMessage()));
            connect(hide, SIGNAL(triggered()), this, SLOT(HideResult()));
        }

        //Start the menu
        menu.exec(e->globalPos());

        if (mContextItem && mApplications->GetApplicationCount() > 0 && mContextItem->parent())
        {
            //Disconnect all signals
            for (int i = 0; i < actions.size(); i++)
            {

                disconnect(actions[i], SIGNAL(triggered()), signalMapper, SLOT(map()));
            }

            disconnect(signalMapper, SIGNAL(mapped(int)),
                       this, SLOT(Context(int)));
            //And remove the signal mapper
            delete signalMapper;
        }

//.........这里部分代码省略.........
开发者ID:rpavlik,项目名称:cppcheck,代码行数:101,代码来源:resultstree.cpp

示例7: GxsMessageFramePostWidget

/** Constructor */
GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWidget *parent) :
	GxsMessageFramePostWidget(rsGxsChannels, parent),
	ui(new Ui::GxsChannelPostsWidget)
{
	/* Invoke the Qt Designer generated object setup routine */
	ui->setupUi(this);


	/* Setup UI helper */

	mStateHelper->addWidget(mTokenTypeAllPosts, ui->progressBar, UISTATE_LOADING_VISIBLE);
	mStateHelper->addWidget(mTokenTypeAllPosts, ui->loadingLabel, UISTATE_LOADING_VISIBLE);
	mStateHelper->addWidget(mTokenTypeAllPosts, ui->filterLineEdit);

	mStateHelper->addWidget(mTokenTypePosts, ui->loadingLabel, UISTATE_LOADING_VISIBLE);

	mStateHelper->addLoadPlaceholder(mTokenTypeGroupData, ui->nameLabel);

	mStateHelper->addWidget(mTokenTypeGroupData, ui->postButton);
	mStateHelper->addWidget(mTokenTypeGroupData, ui->logoLabel);
	mStateHelper->addWidget(mTokenTypeGroupData, ui->subscribeToolButton);

	/* Connect signals */
	connect(ui->postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
	connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
	connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));

	/* add filter actions */
	ui->filterLineEdit->addFilter(QIcon(), tr("Title"), FILTER_TITLE, tr("Search Title"));
	ui->filterLineEdit->addFilter(QIcon(), tr("Message"), FILTER_MSG, tr("Search Message"));
	ui->filterLineEdit->addFilter(QIcon(), tr("Filename"), FILTER_FILE_NAME, tr("Search Filename"));
	connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), ui->feedWidget, SLOT(setFilterText(QString)));
	connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), ui->fileWidget, SLOT(setFilterText(QString)));
	connect(ui->filterLineEdit, SIGNAL(filterChanged(int)), this, SLOT(filterChanged(int)));

	/* Initialize view button */
	//setViewMode(VIEW_MODE_FEEDS); see processSettings
	ui->infoWidget->hide();

	QSignalMapper *signalMapper = new QSignalMapper(this);
	connect(ui->feedToolButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
	connect(ui->fileToolButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
	signalMapper->setMapping(ui->feedToolButton, VIEW_MODE_FEEDS);
	signalMapper->setMapping(ui->fileToolButton, VIEW_MODE_FILES);
	connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(setViewMode(int)));

	/*************** Setup Left Hand Side (List of Channels) ****************/

	ui->loadingLabel->hide();
	ui->progressBar->hide();

	ui->nameLabel->setMinimumWidth(20);

	/* Initialize feed widget */
	ui->feedWidget->setSortRole(ROLE_PUBLISH, Qt::DescendingOrder);
	ui->feedWidget->setFilterCallback(filterItem);

	/* load settings */
	processSettings(true);

	/* Initialize subscribe button */
	QIcon icon;
	icon.addPixmap(QPixmap(":/images/redled.png"), QIcon::Normal, QIcon::On);
	icon.addPixmap(QPixmap(":/images/start.png"), QIcon::Normal, QIcon::Off);
	mAutoDownloadAction = new QAction(icon, "", this);
	mAutoDownloadAction->setCheckable(true);
	connect(mAutoDownloadAction, SIGNAL(triggered()), this, SLOT(toggleAutoDownload()));

	ui->subscribeToolButton->addSubscribedAction(mAutoDownloadAction);

	/* Initialize GUI */
	setAutoDownload(false);
	settingsChanged();
	setGroupId(channelId);
}
开发者ID:heini,项目名称:RetroShare,代码行数:76,代码来源:GxsChannelPostsWidget.cpp

示例8: WriteLog

// adds dynamic actions to the toolbar (example settings)
void RenderWindow::slotPopulateToolbar(bool completeRefresh)
{
	WriteLog("cInterface::PopulateToolbar(QWidget *window, QToolBar *toolBar) started", 2);
	QDir toolbarDir = QDir(systemData.dataDirectory + "toolbar");
	toolbarDir.setSorting(QDir::Time);
	QStringList toolbarFiles = toolbarDir.entryList(QDir::NoDotAndDotDot | QDir::Files);
	QSignalMapper *mapPresetsFromExamplesLoad = new QSignalMapper(this);
	QSignalMapper *mapPresetsFromExamplesRemove = new QSignalMapper(this);
	ui->toolBar->setIconSize(
		QSize(gPar->Get<int>("toolbar_icon_size"), gPar->Get<int>("toolbar_icon_size")));

	QList<QAction *> actions = ui->toolBar->actions();
	QStringList toolbarInActions;
	for (int i = 0; i < actions.size(); i++)
	{
		QAction *action = actions.at(i);
		if (action->objectName() == "actionAdd_Settings_to_Toolbar") continue;
		if (!toolbarFiles.contains(action->objectName()) || completeRefresh)
		{
			// preset has been removed
			ui->toolBar->removeAction(action);
		}
		else
		{
			toolbarInActions << action->objectName();
		}
	}

	for (int i = 0; i < toolbarFiles.size(); i++)
	{
		if (toolbarInActions.contains(toolbarFiles.at(i)))
		{
			// already present
			continue;
		}
		QString filename = systemData.dataDirectory + "toolbar/" + toolbarFiles.at(i);
		cThumbnailWidget *thumbWidget = NULL;

		if (QFileInfo(filename).suffix() == QString("fract"))
		{
			WriteLogString("Generating thumbnail for preset", filename, 2);
			cSettings parSettings(cSettings::formatFullText);
			parSettings.BeQuiet(true);

			if (parSettings.LoadFromFile(filename))
			{
				cParameterContainer *par = new cParameterContainer;
				cFractalContainer *parFractal = new cFractalContainer;
				InitParams(par);
				for (int i = 0; i < NUMBER_OF_FRACTALS; i++)
					InitFractalParams(&parFractal->at(i));

				/****************** TEMPORARY CODE FOR MATERIALS *******************/

				InitMaterialParams(1, par);

				/*******************************************************************/

				if (parSettings.Decode(par, parFractal))
				{
					thumbWidget = new cThumbnailWidget(
						gPar->Get<int>("toolbar_icon_size"), gPar->Get<int>("toolbar_icon_size"), 2, this);
					thumbWidget->UseOneCPUCore(true);
					thumbWidget->AssignParameters(*par, *parFractal);
				}
				delete par;
				delete parFractal;
			}
		}

		if (thumbWidget)
		{
			QWidgetAction *action = new QWidgetAction(this);
			QToolButton *buttonLoad = new QToolButton;
			QVBoxLayout *tooltipLayout = new QVBoxLayout;
			QToolButton *buttonRemove = new QToolButton;

			tooltipLayout->setContentsMargins(3, 3, 3, 3);
			tooltipLayout->addWidget(thumbWidget);
			QIcon iconDelete = QIcon::fromTheme("list-remove", QIcon(":system/icons/list-remove.svg"));
			buttonRemove->setIcon(iconDelete);
			buttonRemove->setMaximumSize(QSize(15, 15));
			buttonRemove->setStyleSheet("margin-bottom: -2px; margin-left: -2px;");
			tooltipLayout->addWidget(buttonRemove);
			buttonLoad->setToolTip(QObject::tr("Toolbar settings: ") + filename);
			buttonLoad->setLayout(tooltipLayout);
			action->setDefaultWidget(buttonLoad);
			action->setObjectName(toolbarFiles.at(i));
			ui->toolBar->addAction(action);

			mapPresetsFromExamplesLoad->setMapping(buttonLoad, filename);
			mapPresetsFromExamplesRemove->setMapping(buttonRemove, filename);
			QApplication::connect(buttonLoad, SIGNAL(clicked()), mapPresetsFromExamplesLoad, SLOT(map()));
			QApplication::connect(
				buttonRemove, SIGNAL(clicked()), mapPresetsFromExamplesRemove, SLOT(map()));
		}
	}
	QApplication::connect(
		mapPresetsFromExamplesLoad, SIGNAL(mapped(QString)), this, SLOT(slotMenuLoadPreset(QString)));
//.........这里部分代码省略.........
开发者ID:valera-rozuvan,项目名称:mandelbulber2,代码行数:101,代码来源:render_window_slots.cpp

示例9: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),

    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QPushButton *buttonUp = new QPushButton(this);
    QPushButton *buttonDown = new QPushButton;
    QPushButton *buttonLeft = new QPushButton;
    QPushButton *buttonRight = new QPushButton;

    this->gridLayout = new QGridLayout;

    this->boardBoundX = 11;
    this->boardBoundY = 11;

    this->_curX = 0;
    this->_curY = this->boardBoundY;

    for (int y = 0; y <= this->boardBoundY; y++) {
        for (int x = 0; x <= this->boardBoundX; x++) {
            QLabel *textBlock = new QLabel;

            if (x == 0 && y == this->boardBoundY)
                textBlock->setText("<span style='color:red'>X</span>");
            else {
                textBlock->setText(QString("<span style='color:black'>%1</span>").arg(this->boardMatrix[y][x]));
            }
            gridLayout->addWidget(textBlock, y, x, 1, 1, Qt::AlignCenter);
        }
    }


    buttonUp->setText("UP");
    buttonDown->setText("DOWN");
    buttonLeft->setText("LEFT");
    buttonRight->setText("RIGHT");

    QSignalMapper *signalMapper = new QSignalMapper(this);
    QObject::connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(moveCharacter(int)));
    QObject::connect(buttonUp, SIGNAL(clicked()), signalMapper, SLOT(map()));
    QObject::connect(buttonDown, SIGNAL(clicked()), signalMapper, SLOT(map()));
    QObject::connect(buttonLeft, SIGNAL(clicked()), signalMapper, SLOT(map()));
    QObject::connect(buttonRight, SIGNAL(clicked()), signalMapper, SLOT(map()));

    signalMapper->setMapping(buttonUp, MOVE_UP);
    signalMapper->setMapping(buttonDown, MOVE_DOWN);
    signalMapper->setMapping(buttonLeft, MOVE_LEFT);
    signalMapper->setMapping(buttonRight, MOVE_RIGHT);

    gridLayout->addWidget(buttonUp, this->boardBoundY + 1, 0, 1, 3, Qt::AlignCenter);
    gridLayout->addWidget(buttonDown, this->boardBoundY + 1, 3, 1, 3, Qt::AlignCenter);
    gridLayout->addWidget(buttonLeft, this->boardBoundY + 1, 6, 1, 3, Qt::AlignCenter);
    gridLayout->addWidget(buttonRight, this->boardBoundY + 1, 9, 1, 3, Qt::AlignCenter);

    QWidget *mainWidget = new QWidget;
    mainWidget->setLayout(gridLayout);
    mainWidget->setWindowTitle("Test");

    if (this->centralWidget())
        this->centralWidget()->setParent(0); // Preserve current central widget
    this->setCentralWidget(mainWidget);

}
开发者ID:JacariB,项目名称:CIS17B_48597_ClassProject,代码行数:65,代码来源:mainwindow.cpp

示例10: QSignalMapper

void ChalRespPage::connectHelpButtons() {
    //Map the values of the help buttons

    //Create a QMapper
    QSignalMapper *mapper = new QSignalMapper(this);

    //Connect the clicked signal with the QSignalMapper
    connect(ui->quickHelpBtn, SIGNAL(clicked()), mapper, SLOT(map()));
    connect(ui->advHelpBtn, SIGNAL(clicked()), mapper, SLOT(map()));

    connect(ui->quickConfigHelpBtn, SIGNAL(clicked()), mapper, SLOT(map()));
    connect(ui->quickParamGenSchemeHelpBtn, SIGNAL(clicked()), mapper, SLOT(map()));
    connect(ui->quickChalRespOptionsHelpBtn, SIGNAL(clicked()), mapper, SLOT(map()));
    connect(ui->quickPvtIdHelpBtn, SIGNAL(clicked()), mapper, SLOT(map()));
    connect(ui->quickSecretKeyHelpBtn, SIGNAL(clicked()), mapper, SLOT(map()));

    connect(ui->advConfigHelpBtn, SIGNAL(clicked()), mapper, SLOT(map()));
    connect(ui->advChalRespOptionsHelpBtn, SIGNAL(clicked()), mapper, SLOT(map()));
    connect(ui->advSecretKeyHelpBtn, SIGNAL(clicked()), mapper, SLOT(map()));

    //Set a value for each button
    mapper->setMapping(ui->quickHelpBtn, HelpBox::Help_ChalRespYubico);
    mapper->setMapping(ui->advHelpBtn, HelpBox::Help_ChalRespHmac);

    mapper->setMapping(ui->quickConfigHelpBtn, HelpBox::Help_ConfigurationSlot);
    mapper->setMapping(ui->quickParamGenSchemeHelpBtn, HelpBox::Help_ParameterGeneration);
    mapper->setMapping(ui->quickChalRespOptionsHelpBtn, HelpBox::Help_ChalRespOption);
    mapper->setMapping(ui->quickPvtIdHelpBtn, HelpBox::Help_PrivateID);
    mapper->setMapping(ui->quickSecretKeyHelpBtn, HelpBox::Help_SecretKey);

    mapper->setMapping(ui->advConfigHelpBtn, HelpBox::Help_ConfigurationSlot);
    mapper->setMapping(ui->advChalRespOptionsHelpBtn, HelpBox::Help_ChalRespOption);
    mapper->setMapping(ui->advSecretKeyHelpBtn, HelpBox::Help_SecretKey);

    //Connect the mapper
    connect(mapper, SIGNAL(mapped(int)), this, SIGNAL(showHelp(int)));
    connect(ui->quickConfigProtectionBox, SIGNAL(showHelp(int)), this, SIGNAL(showHelp(int)));
    connect(ui->advConfigProtectionBox, SIGNAL(showHelp(int)), this, SIGNAL(showHelp(int)));
}
开发者ID:Yubico,项目名称:yubikey-personalization-gui,代码行数:39,代码来源:chalresppage.cpp

示例11: connect

void RPCConsole::setClientModel(ClientModel *model)
{
    clientModel = model;
    ui->trafficGraph->setClientModel(model);
    if (model && clientModel->getPeerTableModel() && clientModel->getBanTableModel())
    {
        // Subscribe to information, replies, messages, errors
        connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));

        setNumBlocks(model->getNumBlocks());
        connect(model, SIGNAL(numBlocksChanged(int)), this, SLOT(setNumBlocks(int)));

        setMasternodeCount(model->getMasternodeCountString());
        connect(model, SIGNAL(strMasternodesChanged(QString)), this, SLOT(setMasternodeCount(QString)));

        updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent());
        connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64)));

        // set up peer table
        ui->peerWidget->setModel(model->getPeerTableModel());
        ui->peerWidget->verticalHeader()->hide();
        ui->peerWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
        ui->peerWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
        ui->peerWidget->setSelectionMode(QAbstractItemView::SingleSelection);
        ui->peerWidget->setContextMenuPolicy(Qt::CustomContextMenu);
        ui->peerWidget->setColumnWidth(PeerTableModel::Address, ADDRESS_COLUMN_WIDTH);
        ui->peerWidget->setColumnWidth(PeerTableModel::Subversion, SUBVERSION_COLUMN_WIDTH);
        ui->peerWidget->setColumnWidth(PeerTableModel::Ping, PING_COLUMN_WIDTH);

        // create context menu actions
        QAction* disconnectAction = new QAction(tr("&Disconnect Node"), this);
        QAction* banAction1h      = new QAction(tr("Ban Node for") + " " + tr("1 &hour"), this);
        QAction* banAction24h     = new QAction(tr("Ban Node for") + " " + tr("1 &day"), this);
        QAction* banAction7d      = new QAction(tr("Ban Node for") + " " + tr("1 &week"), this);
        QAction* banAction365d    = new QAction(tr("Ban Node for") + " " + tr("1 &year"), this);

        // create peer table context menu
        peersTableContextMenu = new QMenu();
        peersTableContextMenu->addAction(disconnectAction);
        peersTableContextMenu->addAction(banAction1h);
        peersTableContextMenu->addAction(banAction24h);
        peersTableContextMenu->addAction(banAction7d);
        peersTableContextMenu->addAction(banAction365d);

        // Add a signal mapping to allow dynamic context menu arguments.
        // We need to use int (instead of int64_t), because signal mapper only supports
        // int or objects, which is okay because max bantime (1 year) is < int_max.
        QSignalMapper* signalMapper = new QSignalMapper(this);
        signalMapper->setMapping(banAction1h, 60*60);
        signalMapper->setMapping(banAction24h, 60*60*24);
        signalMapper->setMapping(banAction7d, 60*60*24*7);
        signalMapper->setMapping(banAction365d, 60*60*24*365);
        connect(banAction1h, SIGNAL(triggered()), signalMapper, SLOT(map()));
        connect(banAction24h, SIGNAL(triggered()), signalMapper, SLOT(map()));
        connect(banAction7d, SIGNAL(triggered()), signalMapper, SLOT(map()));
        connect(banAction365d, SIGNAL(triggered()), signalMapper, SLOT(map()));
        connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(banSelectedNode(int)));

        // peer table context menu signals
        connect(ui->peerWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showPeersTableContextMenu(const QPoint&)));
        connect(disconnectAction, SIGNAL(triggered()), this, SLOT(disconnectSelectedNode()));

        // peer table signal handling - update peer details when selecting new node
        connect(ui->peerWidget->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
            this, SLOT(peerSelected(const QItemSelection &, const QItemSelection &)));
        // peer table signal handling - update peer details when new nodes are added to the model
        connect(model->getPeerTableModel(), SIGNAL(layoutChanged()), this, SLOT(peerLayoutChanged()));

        // set up ban table
        ui->banlistWidget->setModel(model->getBanTableModel());
        ui->banlistWidget->verticalHeader()->hide();
        ui->banlistWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
        ui->banlistWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
        ui->banlistWidget->setSelectionMode(QAbstractItemView::SingleSelection);
        ui->banlistWidget->setContextMenuPolicy(Qt::CustomContextMenu);
        ui->banlistWidget->setColumnWidth(BanTableModel::Address, BANSUBNET_COLUMN_WIDTH);
        ui->banlistWidget->setColumnWidth(BanTableModel::Bantime, BANTIME_COLUMN_WIDTH);
        ui->banlistWidget->horizontalHeader()->setStretchLastSection(true);

        // create ban table context menu action
        QAction* unbanAction = new QAction(tr("&Unban Node"), this);

        // create ban table context menu
        banTableContextMenu = new QMenu();
        banTableContextMenu->addAction(unbanAction);

        // ban table context menu signals
        connect(ui->banlistWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showBanTableContextMenu(const QPoint&)));
        connect(unbanAction, SIGNAL(triggered()), this, SLOT(unbanSelectedNode()));

        // ban table signal handling - clear peer details when clicking a peer in the ban table
        connect(ui->banlistWidget, SIGNAL(clicked(const QModelIndex&)), this, SLOT(clearSelectedNode()));
        // ban table signal handling - ensure ban table is shown or hidden (if empty)
        connect(model->getBanTableModel(), SIGNAL(layoutChanged()), this, SLOT(showOrHideBanTableIfRequired()));
        showOrHideBanTableIfRequired();

        // Provide initial values
        ui->clientVersion->setText(model->formatFullVersion());
        ui->clientName->setText(model->clientName());
        ui->buildDate->setText(model->formatBuildDate());
//.........这里部分代码省略.........
开发者ID:alexudm,项目名称:Simplicity,代码行数:101,代码来源:rpcconsole.cpp

示例12: QDialog

ScriptDebugger::ScriptDebugger(const MODELMAP &models, QStandardItemModel *triggerModel) : QDialog(NULL, Qt::Window)
{
	modelMap = models;
	QSignalMapper *signalMapper = new QSignalMapper(this);

	// Add globals
	for (MODELMAP::const_iterator i = models.constBegin(); i != models.constEnd(); ++i)
	{
		QWidget *dummyWidget = new QWidget(this);
		QScriptEngine *engine = i.key();
		QStandardItemModel *m = i.value();
		m->setParent(this); // take ownership to avoid memory leaks
		QTreeView *view = new QTreeView(this);
		view->setSelectionMode(QAbstractItemView::NoSelection);
		view->setModel(m);
		QString scriptName = engine->globalObject().property("scriptName").toString();
		int player = engine->globalObject().property("me").toInt32();
		QLineEdit *lineEdit = new QLineEdit(this);
		QVBoxLayout *layout = new QVBoxLayout();
		QHBoxLayout *layout2 = new QHBoxLayout();
		QPushButton *updateButton = new QPushButton("Update", this);
		QPushButton *button = new QPushButton("Run", this);
		connect(button, SIGNAL(pressed()), signalMapper, SLOT(map()));
		connect(updateButton, SIGNAL(pressed()), this, SLOT(updateModels()));
		signalMapper->setMapping(button, engine);
		editMap.insert(engine, lineEdit); // store this for slot
		layout->addWidget(view);
		layout2->addWidget(updateButton);
		layout2->addWidget(lineEdit);
		layout2->addWidget(button);
		layout->addLayout(layout2);

		dummyWidget->setLayout(layout);
		tab.addTab(dummyWidget, scriptName + ":" + QString::number(player));
	}
	connect(signalMapper, SIGNAL(mapped(QObject *)), this, SLOT(runClicked(QObject *)));

	// Add triggers
	triggerModel->setParent(this); // take ownership to avoid memory leaks
	triggerView.setModel(triggerModel);
	triggerView.resizeColumnToContents(0);
	triggerView.setSelectionMode(QAbstractItemView::NoSelection);
	triggerView.setSelectionBehavior(QAbstractItemView::SelectRows);
	tab.addTab(&triggerView, "Triggers");

	// Add labels
	labelModel = createLabelModel();
	labelModel->setParent(this); // take ownership to avoid memory leaks
	labelView.setModel(labelModel);
	labelView.resizeColumnToContents(0);
	labelView.setSelectionMode(QAbstractItemView::SingleSelection);
	labelView.setSelectionBehavior(QAbstractItemView::SelectRows);
	connect(&labelView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(labelClickedIdx(const QModelIndex &)));
	QPushButton *button = new QPushButton("Show", this);
	connect(button, SIGNAL(pressed()), this, SLOT(labelClicked()));
	QVBoxLayout *labelLayout = new QVBoxLayout(this);
	labelLayout->addWidget(&labelView);
	labelLayout->addWidget(button);
	QWidget *dummyWidget = new QWidget(this);
	dummyWidget->setLayout(labelLayout);
	tab.addTab(dummyWidget, "Labels");

	// Set up dialog
	QHBoxLayout *layout = new QHBoxLayout(this);
	layout->addWidget(&tab);
	setLayout(layout);
	setSizeGripEnabled(true);
	show();
	raise();
	activateWindow();
}
开发者ID:MrBlackRaven,项目名称:warzone2100,代码行数:71,代码来源:qtscriptdebug.cpp

示例13: QDialog

StaffTextProperties::StaffTextProperties(const StaffTextBase* st, QWidget* parent)
   : QDialog(parent)
      {
      setObjectName("StaffTextProperties");
      setupUi(this);
      if (st->systemFlag()) {
            setWindowTitle(tr("System Text Properties"));
            tabWidget->removeTab(tabWidget->indexOf(tabAeolusStops)); // Aeolus settings  for staff text only
            //if (!enableExperimental) tabWidget->removeTab(tabWidget->indexOf(tabMIDIAction));
            tabWidget->removeTab(tabWidget->indexOf(tabChangeChannel)); // Channel switching  for staff text only
            }
      else {
            setWindowTitle(tr("Staff Text Properties"));
            //tabWidget->removeTab(tabWidget->indexOf(tabSwingSettings)); // Swing settings for system text only, could be disabled here, if desired
#ifndef AEOLUS
            tabWidget->removeTab(tabWidget->indexOf(tabAeolusStops));
#endif
            //if (!enableExperimental) tabWidget->removeTab(tabWidget->indexOf(tabMIDIAction));
            }
      setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
      _staffText = static_cast<StaffTextBase*>(st->clone());

      vb[0][0] = voice1_1;
      vb[0][1] = voice1_2;
      vb[0][2] = voice1_3;
      vb[0][3] = voice1_4;

      vb[1][0] = voice2_1;
      vb[1][1] = voice2_2;
      vb[1][2] = voice2_3;
      vb[1][3] = voice2_4;

      vb[2][0] = voice3_1;
      vb[2][1] = voice3_2;
      vb[2][2] = voice3_3;
      vb[2][3] = voice3_4;

      vb[3][0] = voice4_1;
      vb[3][1] = voice4_2;
      vb[3][2] = voice4_3;
      vb[3][3] = voice4_4;

      channelCombo[0] = channelCombo1;
      channelCombo[1] = channelCombo2;
      channelCombo[2] = channelCombo3;
      channelCombo[3] = channelCombo4;

      //---------------------------------------------------
      // setup "switch channel"
      //---------------------------------------------------

      for (int i = 0; i < 4; ++i)
            initChannelCombo(channelCombo[i], _staffText);

      Part* part = _staffText->staff()->part();
      int tick = static_cast<Segment*>(st->parent())->tick();
      int n = part->instrument(tick)->channel().size();
      int rows = 0;
      for (int voice = 0; voice < VOICES; ++voice) {
            if (_staffText->channelName(voice).isEmpty())
                  continue;
            for (int i = 0; i < n; ++i) {
                  const Channel* a = part->instrument(tick)->channel(i);
                  if (a->name != _staffText->channelName(voice))
                        continue;
                  int row = 0;
                  for (row = 0; row < rows; ++row) {
                        if (channelCombo[row]->currentIndex() == i) {
                              vb[voice][row]->setChecked(true);
                              break;
                              }
                        }
                  if (row == rows) {
                        vb[voice][rows]->setChecked(true);
                        channelCombo[row]->setCurrentIndex(i);
                        ++rows;
                        }
                  break;
                  }
            }
      QSignalMapper* mapper = new QSignalMapper(this);
      for (int row = 0; row < 4; ++row) {
            for (int col = 0; col < 4; ++col) {
                  connect(vb[col][row], SIGNAL(clicked()), mapper, SLOT(map()));
                  mapper->setMapping(vb[col][row], (col << 8) + row);
                  }
            }

      if (_staffText->swing()) {
            setSwingBox->setChecked(true);
            if (_staffText->swingParameters()->swingUnit == MScore::division/2) {
                  swingBox->setEnabled(true);
                  swingEighth->setChecked(true);
                  swingBox->setValue(_staffText->swingParameters()->swingRatio);
                  }
            else if (_staffText->swingParameters()->swingUnit == MScore::division/4) {
                  swingBox->setEnabled(true);
                  swingSixteenth->setChecked(true);
                  swingBox->setValue(_staffText->swingParameters()->swingRatio);
                  }
//.........这里部分代码省略.........
开发者ID:frankvanbever,项目名称:MuseScore,代码行数:101,代码来源:stafftextproperties.cpp

示例14: QAction

void Xaman::menuMusica(const QPoint &pos)
{
    //Menu desplegable de musica con sus correspondientes opciones
    QTreeWidgetItem *nd = ui->Content_Musica->itemAt(pos);
    if(nd){
        //Configuracion de las opciones del menu
        QAction *newAct = new QAction(tr("&Añadir a Reproduccion"), this);
        newAct->setStatusTip(tr("new sth"));
        QAction *newAct1 = new QAction(tr("&Agregar"), this);
        newAct1->setStatusTip(tr("new sth"));
        QSignalMapper *sigmapper = new QSignalMapper(this);
        connect(newAct, SIGNAL(triggered(bool)), sigmapper, SLOT(map()));
        sigmapper->setMapping(newAct,"Reproducir,Musica/" + nd->text(0));
        connect(sigmapper, SIGNAL(mapped(QString)), this, SLOT(reproducirContenido(QString)));

        //Agregar las opciones al menu desplegable
        QMenu menu(this);
        menu.addAction(newAct);
        menu.addAction(newAct1);

        //Submenu de la parte de reproduccion
        QMenu menu2(this);
        QDomDocument playlist;
        QFile file (QDir::currentPath() + "/PlayList/ListasdeReproduccion.xml");
        if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
            //return -1;
        }else{
            if(!playlist.setContent(&file)){
              //return -1;
            }
            file.close();
        }
        QDomElement root = playlist.firstChildElement();
        QDomNodeList items= root.elementsByTagName("List");
        QSignalMapper *mapper = new QSignalMapper(this);
        int cont=1;
        for(int i=0; i< items.count();i++){
            QDomNode itemnode =items.at(i);

            if(itemnode.isElement()){

                QDomElement element = itemnode.toElement();

                QAction *act = new QAction(element.attribute("name"), this);
                connect(act, SIGNAL(triggered(bool)), mapper, SLOT(map()));
                mapper->setMapping(act, element.attribute("name") + "," + QDir::currentPath() + "/Content/Musica/" + nd->text(0));
                if(cont==1){
                connect(mapper, SIGNAL(mapped(QString)), this, SLOT(addToList(QString)));
                cont++;
                }
                menu2.addAction(act);
            }
        }

        //Agregar el submenu
        newAct1->setMenu(&menu2);

        //Posicionamiento del menu de acuerdo al posicionamiento del item en la pantalla
        QPoint pt(pos);
        menu.exec( ui->Content_Shows->mapToGlobal(pos) );
    }
}
开发者ID:alejandrogamezg,项目名称:Xaman,代码行数:62,代码来源:xaman.cpp

示例15: QWidget

Calculator::Calculator(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Calculator), memory(0), result(0), currOperand(0), currOper("")
{
    ui->setupUi(this);

    QSignalMapper *numberPressed = new QSignalMapper(this);

    {
    QObject::connect(ui->n0Button, SIGNAL(clicked()), numberPressed, SLOT(map()));
    QObject::connect(ui->n1Button, SIGNAL(clicked()), numberPressed, SLOT(map()));
    QObject::connect(ui->n2Button, SIGNAL(clicked()), numberPressed, SLOT(map()));
    QObject::connect(ui->n3Button, SIGNAL(clicked()), numberPressed, SLOT(map()));
    QObject::connect(ui->n4Button, SIGNAL(clicked()), numberPressed, SLOT(map()));
    QObject::connect(ui->n5Button, SIGNAL(clicked()), numberPressed, SLOT(map()));
    QObject::connect(ui->n6Button, SIGNAL(clicked()), numberPressed, SLOT(map()));
    QObject::connect(ui->n7Button, SIGNAL(clicked()), numberPressed, SLOT(map()));
    QObject::connect(ui->n8Button, SIGNAL(clicked()), numberPressed, SLOT(map()));
    QObject::connect(ui->n9Button, SIGNAL(clicked()), numberPressed, SLOT(map()));
    QObject::connect(ui->nDotButton, SIGNAL(clicked()), numberPressed, SLOT(map()));
    }

    {
    numberPressed->setMapping(ui->n0Button, "0");
    numberPressed->setMapping(ui->n1Button, "1");
    numberPressed->setMapping(ui->n2Button, "2");
    numberPressed->setMapping(ui->n3Button, "3");
    numberPressed->setMapping(ui->n4Button, "4");
    numberPressed->setMapping(ui->n5Button, "5");
    numberPressed->setMapping(ui->n6Button, "6");
    numberPressed->setMapping(ui->n7Button, "7");
    numberPressed->setMapping(ui->n8Button, "8");
    numberPressed->setMapping(ui->n9Button, "9");
    numberPressed->setMapping(ui->nDotButton, ".");
    }
    QObject::connect(numberPressed, SIGNAL(mapped(QString)), this, SLOT(appendToDisplayString(QString)));
    QObject::connect(this, SIGNAL(displayStringChanged(QString)), ui->lineEdit, SLOT(setText(QString)));

    QObject::connect(ui->cClearButton, SIGNAL(clicked()), this, SLOT(clearDisplayString()));
    QObject::connect(ui->cCEButton, SIGNAL(clicked()), this, SLOT(clearExpression()));
    QObject::connect(ui->cACButton, SIGNAL(clicked()), this, SLOT(clearAll()));
    QObject::connect(ui->cBackSpaceButton, SIGNAL(clicked()), this, SLOT(backSpace()));

    QSignalMapper *operatorPressed = new QSignalMapper;

    QObject::connect(ui->oDivButton, SIGNAL(clicked()), operatorPressed, SLOT(map()));
    QObject::connect(ui->oMultButton, SIGNAL(clicked()), operatorPressed, SLOT(map()));
    QObject::connect(ui->oPlusButton, SIGNAL(clicked()), operatorPressed, SLOT(map()));
    QObject::connect(ui->oMinusButton, SIGNAL(clicked()), operatorPressed, SLOT(map()));
    QObject::connect(ui->oEqButton, SIGNAL(clicked()), operatorPressed, SLOT(map()));

    operatorPressed->setMapping(ui->oDivButton, "/");
    operatorPressed->setMapping(ui->oMultButton, "*");
    operatorPressed->setMapping(ui->oPlusButton, "+");
    operatorPressed->setMapping(ui->oMinusButton, "-");
    operatorPressed->setMapping(ui->oEqButton, "=");

    QObject::connect(operatorPressed, SIGNAL(mapped(QString)), this, SLOT(operButtonPressed(QString)));

    QObject::connect(ui->nDotButton, SIGNAL(clicked(bool)), ui->nDotButton, SLOT(setEnabled(bool)));

    QObject::connect(ui->mClearButton, SIGNAL(clicked()), this, SLOT(clearMemory()));
    QObject::connect(ui->mReadButton, SIGNAL(clicked()), this, SLOT(memoryRead()));
    QObject::connect(ui->mPlusButton, SIGNAL(clicked()), this, SLOT(memoryAdd()));
    QObject::connect(ui->mMinusButton, SIGNAL(clicked()), this, SLOT(memoryDec()));

}
开发者ID:VeselovAlex,项目名称:SecondTerm,代码行数:67,代码来源:calculator.cpp


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