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


C++ SIGNAL函数代码示例

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


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

示例1: ui

ServerChoice::ServerChoice(TeamHolder* team) :
    ui(new Ui::ServerChoice), wasConnected(false), team(team)
{
    ui->setupUi(this);
    ui->announcement->hide();

    ServerChoiceModel *model = new ServerChoiceModel();
    model->setParent(ui->serverList);
    filter = new QSortFilterProxyModel(ui->serverList);
    filter->setSourceModel(model);
    filter->setSortRole(ServerChoiceModel::SortRole);
    ui->serverList->setModel(filter);

    connect(ui->description, SIGNAL(anchorClicked(QUrl)), SLOT(anchorClicked(QUrl)));

    QSettings settings;

    registry_connection = new Analyzer(true);
    connect(registry_connection, SIGNAL(connected()), SLOT(connected()));

    registry_connection->connectTo(
        settings.value("ServerChoice/RegistryServer", "pokemon-online-registry.dynalias.net").toString(),
        settings.value("ServerChoice/RegistryPort", 5090).toUInt()
    );
    registry_connection->setParent(this);

    ui->switchPort->setIcon(QApplication::style()->standardIcon(QStyle::SP_BrowserReload));

    connect(registry_connection, SIGNAL(connectionError(int,QString)), SLOT(connectionError(int , QString)));
    connect(registry_connection, SIGNAL(regAnnouncementReceived(QString)), ui->announcement, SLOT(setText(QString)));
    connect(registry_connection, SIGNAL(regAnnouncementReceived(QString)), ui->announcement, SLOT(show()));

    connect(registry_connection, SIGNAL(serverReceived(ServerInfo)), model, SLOT(addServer(ServerInfo)));
    connect(this, SIGNAL(clearList()), model, SLOT(clear()));
    connect(registry_connection, SIGNAL(serverReceived(ServerInfo)), SLOT(serverAdded()));

    //TO-DO: Make  the item 0 un-resizable and unselectable - Latios

    ui->serverList->setColumnWidth(0, settings.value("ServerChoice/PasswordProtectedWidth", 26).toInt());
    ui->serverList->setColumnWidth(1, settings.value("ServerChoice/ServerNameWidth", 152).toInt());
    if (settings.contains("ServerChoice/PlayersInfoWidth")) {
        ui->serverList->setColumnWidth(2, settings.value("ServerChoice/PlayersInfoWidth").toInt());
    }
    ui->serverList->horizontalHeader()->setStretchLastSection(true);

    connect(ui->serverList, SIGNAL(activated(QModelIndex)), SLOT(regServerChosen(QModelIndex)));
    connect(ui->serverList, SIGNAL(currentCellChanged(QModelIndex)), SLOT(showDetails(QModelIndex)));

    ui->nameEdit->setText(team->name());
    ui->advServerEdit->addItem(settings.value("ServerChoice/DefaultServer").toString());
    connect(ui->nameEdit, SIGNAL(returnPressed()), SLOT(advServerChosen()));
    connect(ui->advServerEdit->lineEdit(), SIGNAL(returnPressed()), SLOT(advServerChosen()));

    QCompleter *completer = new QCompleter(ui->advServerEdit);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    QStringList res = settings.value("ServerChoice/SavedServers").toStringList();

    foreach (QString r, res) {
        if (r.contains("-")) {
            savedServers.push_back(QStringList() << r.section("-", -1).trimmed() << r.section("-", 0, -2).trimmed());
        } else {
            savedServers.push_back(QStringList() << r << "");
        }
    }

    QStringListModel *m = new QStringListModel(res, completer);

    completer->setModel(m);
    ui->advServerEdit->setCompleter(completer);
    ui->advServerEdit->setModel(m);

    connect(ui->goBack, SIGNAL(clicked()), SIGNAL(rejected()));
    connect(ui->advancedConnection, SIGNAL(clicked()), SLOT(advServerChosen()));

    QTimer *t = new QTimer(this);
    t->singleShot(5000, this, SLOT(timeout()));

#if QT_VERSION >= QT_VERSION_CHECK(4,8,0)
    ui->serverList->sortByColumn(ServerChoiceModel::Players, Qt::SortOrder(filter->headerData(ServerChoiceModel::Players, Qt::Horizontal, Qt::InitialSortOrderRole).toInt()));
#else
    ui->serverList->sortByColumn(ServerChoiceModel::Players, Qt::DescendingOrder);
#endif
}
开发者ID:ElementsPO,项目名称:pokemon-online,代码行数:83,代码来源:serverchoice.cpp

示例2: defined

/** Imprime directamente sobre formato PS */
bool MReportViewer::printReportToPS(const QString &outPsFile)
{
  // Check for a report
  if (report == 0)
    return false;

#if defined(Q_OS_WIN32) || defined(Q_OS_MACX)
  return printGhostReportToPS(outPsFile);
#endif

  // Get the page count
  int cnt = report->pageCount();

  // Check if there is a report or any pages to print
  if (cnt == 0) {
    QMessageBox::critical(this, "Kugar", tr("No hay páginas en el\ninforme para."), QMessageBox::Ok,
                          QMessageBox::NoButton, QMessageBox::NoButton);
    return false;
  }

  // Set the printer dialog
  printer = new QPrinter(QPrinter::HighResolution);
  printer->setPageSize((QPrinter::PageSize) report->pageSize());
  printer->setOrientation((QPrinter::Orientation) report->pageOrientation());
  printer->setMinMax(1, cnt);
  printer->setFromTo(1, cnt);
  printer->setFullPage(true);
  printer->setColorMode(QPrinter::Color);
  printer->setNumCopies(numCopies_);
  printer->setOutputToFile(true);
  printer->setOutputFileName(outPsFile);

  QPicture *page;
  QPainter painter;
  bool printRev = false;

  // Save the viewer's page index
  int viewIdx = report->getCurrentIndex();

  // Check the order we are printing the pages
  if (printer->pageOrder() == QPrinter::LastPageFirst)
    printRev = true;

  // Get the count of pages and copies to print
  int printFrom = printer->fromPage() - 1;
  int printTo = printer->toPage();
  int printCnt = (printTo - printFrom);
  int printCopies = printer->numCopies();
  int totalSteps = printCnt * printCopies;
  int currentStep = 1;

  // Set copies to 1, QPrinter copies does not appear to work ...
  printer->setNumCopies(numCopies_);
  printer->setResolution(dpi_);

  // Setup the progress dialog
  QProgressDialog progress(tr("Imprimiendo Informe..."), tr("Cancelar"), totalSteps, this, tr("progreso"), true);
  progress.setMinimumDuration(M_PROGRESS_DELAY);
  QObject::connect(&progress, SIGNAL(cancelled()), this, SLOT(slotCancelPrinting()));
  progress.setProgress(0);
  qApp->processEvents();

  // Start the printer
  painter.begin(printer);
  QPaintDeviceMetrics pdm(printer);
  QSize dim(report->pageDimensions());
  painter.setWindow(0, 0, dim.width(), dim.height());
  painter.setViewport(0, 0, pdm.width(), pdm.height());

  // Print each page in the collection
  for (int i = printFrom; i < printTo; i++, currentStep++) {
    if (!printer->aborted()) {
      progress.setProgress(currentStep);
      qApp->processEvents();
      if (printRev)
        report->setCurrentPage((printCnt == 1) ? i : (printCnt - 1) - i);
      else
        report->setCurrentPage(i);

      page = report->getCurrentPage();
      page->play(&painter);
      if ((i - printFrom) < printCnt - 1)
        printer->newPage();
    } else {
      break;
    }
  }

  // Cleanup printing
  painter.end();
  report->setCurrentPage(viewIdx);
  delete printer;
  return true;
}
开发者ID:afibanez,项目名称:eneboo,代码行数:95,代码来源:mreportviewer.cpp

示例3: QDialog


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

    TextLabel1 = new QLabel( this, "TextLabel1" );
    TextLabel1->setText( tr( "Buddy to pounce" ) );
    Layout3->addWidget( TextLabel1 );

    buddyName = new QComboBox( FALSE, this, "buddyName" );
    buddyName->setEditable( TRUE );
    Layout3->addWidget( buddyName );
    NewPounceLayout->addLayout( Layout3 );

    EventGroup = new QButtonGroup( this, "EventGroup" );
    EventGroup->setTitle( tr( "When the buddy..." ) );
    EventGroup->setColumnLayout(0, Qt::Vertical );
    EventGroup->layout()->setSpacing( 0 );
    EventGroup->layout()->setMargin( 0 );
    EventGroupLayout = new QVBoxLayout( EventGroup->layout() );
    EventGroupLayout->setAlignment( Qt::AlignTop );
    EventGroupLayout->setSpacing( 6 );
    EventGroupLayout->setMargin( 11 );

    event_signOn = new QRadioButton( EventGroup, "event_signOn" );
    event_signOn->setText( tr( "Signs On" ) );
    QWhatsThis::add(  event_signOn, tr( "When the buddy assigned signs onto aim, the pounce will take place. " ) );
    EventGroupLayout->addWidget( event_signOn );

    event_returnFromAway = new QRadioButton( EventGroup, "event_returnFromAway" );
    event_returnFromAway->setText( tr( "Returns from away" ) );
    QWhatsThis::add(  event_returnFromAway, tr( "When the buddy assigned returns from being away, the pounce will take place. " ) );
    EventGroupLayout->addWidget( event_returnFromAway );

    event_returnFromIdle = new QRadioButton( EventGroup, "event_returnFromIdle" );
    event_returnFromIdle->setText( tr( "Returns from being idle" ) );
    QWhatsThis::add(  event_returnFromIdle, tr( "When the buddy assigned returns from being idle, the pounce will take place. " ) );
    EventGroupLayout->addWidget( event_returnFromIdle );
    NewPounceLayout->addWidget( EventGroup );

    ActionGroup = new QButtonGroup( this, "ActionGroup" );
    ActionGroup->setTitle( tr( "Do the following actions..." ) );
    ActionGroup->setColumnLayout(0, Qt::Vertical );
    ActionGroup->layout()->setSpacing( 0 );
    ActionGroup->layout()->setMargin( 0 );
    ActionGroupLayout = new QVBoxLayout( ActionGroup->layout() );
    ActionGroupLayout->setAlignment( Qt::AlignTop );
    ActionGroupLayout->setSpacing( 6 );
    ActionGroupLayout->setMargin( 11 );

    action_openChatWindow = new QCheckBox( ActionGroup, "action_openChatWindow" );
    action_openChatWindow->setText( tr( "Open a chat window" ) );
    QWhatsThis::add(  action_openChatWindow, tr( "When you pounce the buddy you want a chat window to be opened." ) );
    ActionGroupLayout->addWidget( action_openChatWindow );

    action_sendMessage = new QCheckBox( ActionGroup, "action_sendMessage" );
    action_sendMessage->setText( tr( "Send the following message" ) );
    QWhatsThis::add(  action_sendMessage, tr( "When you pounce send the following message to the buddy that has been assigned this pounce." ) );
    ActionGroupLayout->addWidget( action_sendMessage );

    action_message = new QMultiLineEdit( ActionGroup, "action_message" );
#if (KDE_VERSION_MAJOR==3)
    action_message->setMaxLines( 1800 );
#else
    action_message->setMaxLength( 1800 );
#endif
    action_message->setWordWrap( QMultiLineEdit::WidgetWidth );
    ActionGroupLayout->addWidget( action_message );

    action_doCommand = new QCheckBox( ActionGroup, "action_doCommand" );
    action_doCommand->setText( tr( "Exec the following command" ) );
    ActionGroupLayout->addWidget( action_doCommand );

    action_command = new QLineEdit( ActionGroup, "action_command" );
    ActionGroupLayout->addWidget( action_command );
    NewPounceLayout->addWidget( ActionGroup );

    doNotRemove = new QCheckBox( this, "doNotRemove" );
    doNotRemove->setText( tr( "Recurring pounce" ) );
    NewPounceLayout->addWidget( doNotRemove );

    Layout1 = new QHBoxLayout; 
    Layout1->setSpacing( 6 );
    Layout1->setMargin( 0 );
    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    Layout1->addItem( spacer );

    buttonOk = new QPushButton( this, "buttonOk" );
    buttonOk->setText( tr( "&OK" ) );
    buttonOk->setAutoDefault( TRUE );
    buttonOk->setDefault( TRUE );
    Layout1->addWidget( buttonOk );

    buttonCancel = new QPushButton( this, "buttonCancel" );
    buttonCancel->setText( tr( "&Cancel" ) );
    buttonCancel->setAutoDefault( TRUE );
    Layout1->addWidget( buttonCancel );
    NewPounceLayout->addLayout( Layout1 );

    // signals and slots connections
    connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
    connect( buttonOk, SIGNAL( clicked() ), this, SLOT( verify() ) );
    connect( action_doCommand, SIGNAL( toggled(bool) ), action_command, SLOT( setEnabled(bool) ) );
}
开发者ID:icefox,项目名称:kinkatta,代码行数:101,代码来源:newpounce.cpp

示例4: setWindowFlags

#ifdef Q_OS_MAC
    setWindowFlags((windowFlags() & ~Qt::WindowType_Mask) | Qt::Sheet);
    setStyleSheet(styleSheet() + " #MovieSearch { border: 1px solid rgba(0, 0, 0, 100); border-top: none; }");
#else
    setWindowFlags((windowFlags() & ~Qt::WindowType_Mask) | Qt::Dialog);
#endif

    foreach (ScraperInterface *scraper, Manager::instance()->scrapers()) {
        ui->comboScraper->addItem(scraper->name(), scraper->identifier());
        connect(scraper, SIGNAL(searchDone(QList<ScraperSearchResult>)), this, SLOT(showResults(QList<ScraperSearchResult>)));
    }
    ui->comboScraper->setCurrentIndex(Settings::instance()->currentMovieScraper());

    connect(ui->comboScraper, SIGNAL(currentIndexChanged(int)), this, SLOT(search()));
    connect(ui->searchString, SIGNAL(returnPressed()), this, SLOT(search()));
    connect(ui->results, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(resultClicked(QTableWidgetItem*)));
    connect(ui->buttonClose, SIGNAL(clicked()), this, SLOT(reject()));

    ui->chkActors->setMyData(MovieScraperInfos::Actors);
    ui->chkBackdrop->setMyData(MovieScraperInfos::Backdrop);
    ui->chkCertification->setMyData(MovieScraperInfos::Certification);
    ui->chkCountries->setMyData(MovieScraperInfos::Countries);
    ui->chkDirector->setMyData(MovieScraperInfos::Director);
    ui->chkGenres->setMyData(MovieScraperInfos::Genres);
    ui->chkOverview->setMyData(MovieScraperInfos::Overview);
    ui->chkPoster->setMyData(MovieScraperInfos::Poster);
    ui->chkRating->setMyData(MovieScraperInfos::Rating);
    ui->chkReleased->setMyData(MovieScraperInfos::Released);
    ui->chkRuntime->setMyData(MovieScraperInfos::Runtime);
    ui->chkSet->setMyData(MovieScraperInfos::Set);
开发者ID:DanoneKiD,项目名称:MediaElch,代码行数:30,代码来源:MovieSearch.cpp

示例5: emitFailed

void OneSixUpdate::jarlibStart()
{
	OneSixInstance *inst = (OneSixInstance *)m_inst;
	bool successful = inst->reloadFullVersion();
	if (!successful)
	{
		emitFailed("Failed to load the version description file (version.json). It might be "
				   "corrupted, missing or simply too new.");
		return;
	}

	std::shared_ptr<OneSixVersion> version = inst->getFullVersion();

	// download the right jar, save it in versions/$version/$version.jar
	QString urlstr("http://s3.amazonaws.com/Minecraft.Download/versions/");
	urlstr += version->id + "/" + version->id + ".jar";
	QString targetstr("versions/");
	targetstr += version->id + "/" + version->id + ".jar";

	auto job = new NetJob("Libraries for instance " + inst->name());
	job->addNetAction(FileDownload::make(QUrl(urlstr), targetstr));
	jarlibDownloadJob.reset(job);

	auto libs = version->getActiveNativeLibs();
	libs.append(version->getActiveNormalLibs());

	auto metacache = MMC->metacache();
	QList<ForgeXzDownloadPtr> ForgeLibs;
	bool already_forge_xz = false;
	for (auto lib : libs)
	{
		if (lib->hint() == "local")
			continue;
		auto entry = metacache->resolveEntry("libraries", lib->storagePath());
		if (entry->stale)
		{
			if (lib->hint() == "forge-pack-xz")
			{
				ForgeLibs.append(ForgeXzDownload::make(lib->storagePath(), entry));
			}
			else
			{
				jarlibDownloadJob->addNetAction(CacheDownload::make(lib->downloadUrl(), entry));
			}
		}
	}
	// TODO: think about how to propagate this from the original json file... or IF AT ALL
	QString forgeMirrorList = "http://files.minecraftforge.net/mirror-brand.list";
	if (!ForgeLibs.empty())
	{
		jarlibDownloadJob->addNetAction(
			ForgeMirrors::make(ForgeLibs, jarlibDownloadJob, forgeMirrorList));
	}

	connect(jarlibDownloadJob.get(), SIGNAL(succeeded()), SLOT(jarlibFinished()));
	connect(jarlibDownloadJob.get(), SIGNAL(failed()), SLOT(jarlibFailed()));
	connect(jarlibDownloadJob.get(), SIGNAL(progress(qint64, qint64)),
			SIGNAL(progress(qint64, qint64)));

	jarlibDownloadJob->start();
}
开发者ID:mafen,项目名称:MultiMC5,代码行数:61,代码来源:OneSixUpdate.cpp

示例6: QWidget


//.........这里部分代码省略.........
    dateWidget->addItem(tr("This week"), ThisWeek);
    dateWidget->addItem(tr("This month"), ThisMonth);
    dateWidget->addItem(tr("Last month"), LastMonth);
    dateWidget->addItem(tr("This year"), ThisYear);
    dateWidget->addItem(tr("Range..."), Range);
    hlayout->addWidget(dateWidget);

    typeWidget = new QComboBox(this);
#ifdef Q_OS_MAC
    typeWidget->setFixedWidth(121);
#else
    typeWidget->setFixedWidth(120);
#endif

    typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES);
    typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) |
                                        TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther));
    typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) |
                                  TransactionFilterProxy::TYPE(TransactionRecord::SendToOther));
    typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf));
    typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated));
    typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other));

    hlayout->addWidget(typeWidget);

    addressWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    addressWidget->setPlaceholderText(tr("Enter address or label to search"));
#endif
    hlayout->addWidget(addressWidget);

    amountWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    amountWidget->setPlaceholderText(tr("Min amount"));
#endif
#ifdef Q_OS_MAC
    amountWidget->setFixedWidth(97);
#else
    amountWidget->setFixedWidth(100);
#endif
    amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this));
    hlayout->addWidget(amountWidget);

    QVBoxLayout *vlayout = new QVBoxLayout(this);
    vlayout->setContentsMargins(0,0,0,0);
    vlayout->setSpacing(0);

    QTableView *view = new QTableView(this);
    vlayout->addLayout(hlayout);
    vlayout->addWidget(createDateRangeWidget());
    vlayout->addWidget(view);
    vlayout->setSpacing(0);
    int width = view->verticalScrollBar()->sizeHint().width();
    // Cover scroll bar width with spacing
#ifdef Q_OS_MAC
    hlayout->addSpacing(width+2);
#else
    hlayout->addSpacing(width);
#endif
    // Always show scroll bar
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    view->setTabKeyNavigation(false);
    view->setContextMenuPolicy(Qt::CustomContextMenu);

    transactionView = view;

    // Actions
    QAction *copyAddressAction = new QAction(tr("Copy address"), this);
    QAction *copyLabelAction = new QAction(tr("Copy label"), this);
    QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
    QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this);
    QAction *editLabelAction = new QAction(tr("Edit label"), this);
    QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);

    contextMenu = new QMenu();
    contextMenu->addAction(copyAddressAction);
    contextMenu->addAction(copyLabelAction);
    contextMenu->addAction(copyAmountAction);
    contextMenu->addAction(copyTxIDAction);
    contextMenu->addAction(editLabelAction);
    contextMenu->addAction(showDetailsAction);

    // Connect actions
    connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
    connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int)));
    connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString)));
    connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString)));

    connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex)));
    connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));

    connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
    connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
    connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
    connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID()));
    connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
    connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
}
开发者ID:eurocoin-project,项目名称:eurocoin,代码行数:101,代码来源:transactionview.cpp

示例7: QgsComposerItemBaseWidget

QgsComposerItemWidget::QgsComposerItemWidget( QWidget* parent, QgsComposerItem* item ): QgsComposerItemBaseWidget( parent, item ), mItem( item )
{

  setupUi( this );

  //make button exclusive
  QButtonGroup* buttonGroup = new QButtonGroup( this );
  buttonGroup->addButton( mUpperLeftCheckBox );
  buttonGroup->addButton( mUpperMiddleCheckBox );
  buttonGroup->addButton( mUpperRightCheckBox );
  buttonGroup->addButton( mMiddleLeftCheckBox );
  buttonGroup->addButton( mMiddleCheckBox );
  buttonGroup->addButton( mMiddleRightCheckBox );
  buttonGroup->addButton( mLowerLeftCheckBox );
  buttonGroup->addButton( mLowerMiddleCheckBox );
  buttonGroup->addButton( mLowerRightCheckBox );
  buttonGroup->setExclusive( true );

  setValuesForGuiElements();
  connect( mItem->composition(), SIGNAL( paperSizeChanged() ), this, SLOT( setValuesForGuiPositionElements() ) );
  connect( mItem, SIGNAL( sizeChanged() ), this, SLOT( setValuesForGuiPositionElements() ) );
  connect( mItem, SIGNAL( itemChanged() ), this, SLOT( setValuesForGuiNonPositionElements() ) );

  connect( mTransparencySlider, SIGNAL( valueChanged( int ) ), mTransparencySpnBx, SLOT( setValue( int ) ) );
  connect( mTransparencySpnBx, SIGNAL( valueChanged( int ) ), mTransparencySlider, SLOT( setValue( int ) ) );

  //connect atlas signals to data defined buttons
  QgsAtlasComposition* atlas = atlasComposition();
  if ( atlas )
  {
    //repopulate data defined buttons if atlas layer changes
    connect( atlas, SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ),
             this, SLOT( populateDataDefinedButtons() ) );
    connect( atlas, SIGNAL( toggled( bool ) ), this, SLOT( populateDataDefinedButtons() ) );
  }

  //connect data defined buttons
  connect( mXPositionDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty( ) ) );
  connect( mXPositionDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty( ) ) );

  connect( mYPositionDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty( ) ) );
  connect( mYPositionDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty( ) ) );

  connect( mWidthDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty( ) ) );
  connect( mWidthDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty( ) ) );

  connect( mHeightDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty( ) ) );
  connect( mHeightDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty( ) ) );

  connect( mItemRotationDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty( ) ) );
  connect( mItemRotationDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty( ) ) );

  connect( mTransparencyDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty( ) ) );
  connect( mTransparencyDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty( ) ) );

  connect( mBlendModeDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty( ) ) );
  connect( mBlendModeDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty( ) ) );

  connect( mExcludePrintsDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty( ) ) );
  connect( mExcludePrintsDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty( ) ) );
}
开发者ID:JanisE,项目名称:QGIS,代码行数:61,代码来源:qgscomposeritemwidget.cpp

示例8: QObject

MousePluginWidget::MousePluginWidget(const QString &pluginName, const QString &trigger, QGridLayout *layoutHack, QWidget *parent)
    : QObject(parent),
      m_configDlg(0),
      m_containment(0),
      m_lastConfigLocation(trigger),
      m_tempConfigParent(QString(), KConfig::SimpleConfig)
{
    KPluginInfo::List plugins = Plasma::ContainmentActions::listContainmentActionsInfo();
    if (plugins.isEmpty()) {
        //panic!!
        QLabel *fail = new QLabel(i18n("No plugins found, check your installation."), parent);
        layoutHack->addWidget(fail, 0, 0);
        return;
    }

    //make us some widgets
    m_pluginList = new QComboBox(parent);
    m_aboutButton = new QToolButton(parent);
    m_clearButton = new QToolButton(parent);
    m_triggerButton = new MouseInputButton(parent);
    m_configButton = new QToolButton(parent);
    //m_ui.description->setText(plugin.comment());

    //plugin list
    //FIXME is there some way to share this across all the entries?
    foreach (const KPluginInfo& plugin, plugins) {
        if (plugin.property("NoDisplay").toBool()) {
            continue;
        }

        m_pluginList->addItem(KIcon(plugin.icon()), plugin.name(), QVariant::fromValue(plugin));
        if (plugin.pluginName() == pluginName) {
            m_pluginList->setCurrentIndex(m_pluginList->count() - 1);
            m_plugin = plugin;
        }
    }

    if (! m_plugin.isValid()) {
        //probably an empty string; pick the first one
        m_pluginList->setCurrentIndex(0);
        m_plugin = plugins.first();
    }

    //I can haz config?
    m_tempConfig = KConfigGroup(&m_tempConfigParent, "test");
    if (!m_plugin.property("X-Plasma-HasConfigurationInterface").toBool()) {
        m_configButton->setVisible(false);
    }

    setTrigger(trigger);

    //pretty icons for the buttons
    m_aboutButton->setIcon(KIcon("dialog-information"));
    m_aboutButton->setToolTip(i18nc("About mouse action", "About"));
    m_triggerButton->setIcon(KIcon("input-mouse"));
    m_configButton->setIcon(KIcon("configure"));
    m_configButton->setToolTip(i18nc("Configure mouse action", "Configure"));
    m_clearButton->setIcon(KIcon("list-remove"));
    m_clearButton->setToolTip(i18nc("Remove mouse action", "Remove"));

    //HACK
    //FIXME what's the Right Way to do this?
    int row = layoutHack->rowCount();
    layoutHack->addWidget(m_triggerButton, row, 0);
    layoutHack->addWidget(m_pluginList, row, 1);
    layoutHack->addWidget(m_configButton, row, 2);
    layoutHack->addWidget(m_aboutButton, row, 3);
    layoutHack->addWidget(m_clearButton, row, 4);

    //connect
    connect(m_pluginList, SIGNAL(currentIndexChanged(int)), this, SLOT(setPlugin(int)));
    connect(m_triggerButton, SIGNAL(triggerChanged(QString,QString)), this, SLOT(changeTrigger(QString,QString)));
    connect(m_configButton, SIGNAL(clicked()), this, SLOT(configure()));
    connect(m_clearButton, SIGNAL(clicked()), this, SLOT(clearTrigger()));
    connect(m_aboutButton, SIGNAL(clicked()), this, SLOT(showAbout()));
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:76,代码来源:mousepluginwidget.cpp

示例9: QWidget

QalfModeratorWidget::QalfModeratorWidget(QWidget * parent) : QWidget(parent) {
	vlayout = new QVBoxLayout(this) ;

	noKeySetLabel = new QLabel() ;
	noKeySetLabel->setWordWrap(true) ;
	vlayout->addWidget(noKeySetLabel) ;

	// file path
	fileLabel = new QLabel(tr("File :")) ;
	fileValue = new QLineEdit(QString("/home/alf/tentative_de.ogg")) ;
	openFileButton = new QPushButton(QIcon(":/icons/folder_open.png"),QString()) ;
	connect(openFileButton,SIGNAL(clicked()),this,SLOT(openFile())) ;
	fileLayout = new QHBoxLayout() ;
	fileLayout->addWidget(fileLabel) ;
	fileLayout->addWidget(fileValue) ;
	fileLayout->addWidget(openFileButton) ;

	vlayout->addLayout(fileLayout) ;

	// general informations
	infoBox = new QGroupBox(tr("Informations about file")) ;
	QGridLayout *  infoLayout = new QGridLayout() ;
	titleLabel = new QLabel(tr("title :")) ;
	titleValue = new QLineEdit("Tentative de") ;
	authorsLabel = new QLabel(tr("authors :")) ;
	authorsValue = new QLineEdit("VoX") ;
	licenseLabel = new QLabel(tr("license :")) ;
	licenseValue = new QComboBox() ;
	keywordsLabel = new QLabel(tr("keywords :")) ;
	keywordsValue = new QLineEdit("VoX") ;
	infoLayout->addWidget(titleLabel,0,0) ;
	infoLayout->addWidget(titleValue,0,1) ;
	infoLayout->addWidget(authorsLabel,1,0) ;
	infoLayout->addWidget(authorsValue,1,1) ;
	infoLayout->addWidget(licenseLabel,0,3) ;
	infoLayout->addWidget(licenseValue,0,4) ;
	infoLayout->addWidget(keywordsLabel,1,3) ;
	infoLayout->addWidget(keywordsValue,1,4) ;
	infoLayout->setColumnMinimumWidth(2,25) ;
	infoLayout->setRowStretch(2,1) ;
	infoLayout->setColumnStretch(0,0) ;
	infoLayout->setColumnStretch(1,2) ;
	infoLayout->setColumnStretch(2,0) ;
	infoLayout->setColumnStretch(3,0) ;
	infoLayout->setColumnStretch(4,1) ;
	infoBox->setLayout(infoLayout);
	vlayout->addWidget(infoBox) ;

	// medium specific
	mediumBox = new QGroupBox(tr("Informations specific to medium")) ;
	QVBoxLayout * mediumLayout = new QVBoxLayout() ;
	
	mediumInfo = new QStackedWidget() ;
	mediumInfo->addWidget(new QalfImageInfoWidget()) ;
	mediumLayout->addWidget(mediumInfo) ;

	mediumBox->setLayout(mediumLayout) ;
	
	vlayout->addWidget(mediumBox) ;

	vlayout->addStretch(1) ;

	QSize iconSize(22,22) ;
	sendButton = new QPushButton(tr("Send torrent")) ;
	sendButton->setIcon(QIcon(":/icons/vcs_add.png")) ;
	sendButton->setIconSize(iconSize) ;
	connect(sendButton,SIGNAL(clicked()),this,SLOT(sendTorrent())) ;
	buttonLayout = new QHBoxLayout() ;
	buttonLayout->addStretch() ;
	buttonLayout->addWidget(sendButton) ;
	vlayout->addLayout(buttonLayout) ;
	setLayout(vlayout) ;
	switchToNokey() ;
	checkKey() ;
}
开发者ID:BackupTheBerlios,项目名称:torrentlibre-svn,代码行数:75,代码来源:qalfmoderatorwidget.cpp

示例10: FriendItem

void FriendsWidget::drawFriendsWidget()
{
    //Friends
    FriendItem *fitem = new FriendItem(this);
    fitem->setPos(18, 50);
    fitem->setName("Siraj");
    //fitem->setIcon

    connect(fitem, SIGNAL(clicked()), this, SLOT(spin()));

    mItems[fitem->name()] = fitem;

    fitem = new FriendItem(this);
    fitem->setPos(18, 100);
    fitem->setName("Lahiru");
    //fitem->setIcon

    connect(fitem, SIGNAL(clicked()), this, SLOT(spin()));

    mItems[fitem->name()] = fitem;

    fitem = new FriendItem(this);
    fitem->setPos(18, 150);
    fitem->setName("Bud");
    //fitem->setIcon

    connect(fitem, SIGNAL(clicked()), this, SLOT(spin()));

    mItems[fitem->name()] = fitem;

    fitem = new FriendItem(this);
    fitem->setPos(18, 200);
    fitem->setName("Mani");
    //fitem->setIcon

    connect(fitem, SIGNAL(clicked()), this, SLOT(spin()));

    mItems[fitem->name()] = fitem;

    //Actions
    FriendItem *action = new FriendItem(this);
    action->setPos(18, 50);
    action->setName("Chat");
    action->setIcon(QPixmap(mPrefix + "chat.png"));
    action->hide();

    connect(action, SIGNAL(clicked()), this, SLOT(spin()));

    mActions[action->name()] = action;

    action = new FriendItem(this);
    action->setPos(18, 100);
    action->setName("Webcam");
    action->setIcon(QPixmap(mPrefix + "webcam.png"));
    action->hide();

    connect(action, SIGNAL(clicked()), this, SLOT(spin()));

    mActions[action->name()] = action;

    action = new FriendItem(this);
    action->setPos(18, 150);
    action->setName("Blog");
    action->setIcon(QPixmap(mPrefix + "blog.png"));
    action->hide();

    connect(action, SIGNAL(clicked()), this, SLOT(spin()));

    mActions[action->name()] = action;

    action = new FriendItem(this);
    action->setPos(18, 200);
    action->setName("Twitter");
    action->setIcon(QPixmap(mPrefix + "twitter.png"));
    action->hide();

    connect(action, SIGNAL(clicked()), this, SLOT(spin()));

    mActions[action->name()] = action;

    m_main_bg = QImage(mPrefix + "default.png");
}
开发者ID:sirajrazick,项目名称:plexydesk,代码行数:82,代码来源:friendswidget.cpp

示例11: QTextEdit

ScriptEdit::ScriptEdit(ScriptingEnv *env, QWidget *parent, const char *name)
  : QTextEdit(parent, name), scripted(env), d_error(false), d_completer(0),
  d_file_name(QString::null), d_search_string(QString::null), d_output_widget(NULL)
{
	myScript = scriptEnv->newScript("", this, name);
	connect(myScript, SIGNAL(error(const QString&, const QString&, int)), this, SLOT(insertErrorMsg(const QString&)));
	connect(myScript, SIGNAL(print(const QString&)), this, SLOT(scriptPrint(const QString&)));
	connect(myScript, SIGNAL(error(const QString&, const QString&, int)),
			this, SIGNAL(error(const QString&, const QString&, int)));

	setLineWrapMode(NoWrap);
	setUndoRedoEnabled(true);
	setTextFormat(Qt::PlainText);
	setAcceptRichText (false);

#ifdef SCRIPTING_PYTHON
	if (scriptEnv->name() == QString("Python"))
		d_highlighter = new PythonSyntaxHighlighter(this);
	else
		d_highlighter = NULL;
#endif

	d_fmt_default.setBackground(palette().brush(QPalette::Base));

	printCursor = textCursor();
	scriptsDirPath = qApp->applicationDirPath();

	actionExecute = new QAction(tr("E&xecute"), this);
	actionExecute->setShortcut( tr("Ctrl+J") );
	connect(actionExecute, SIGNAL(activated()), this, SLOT(execute()));

	actionExecuteAll = new QAction(tr("Execute &All"), this);
	actionExecuteAll->setShortcut( tr("Ctrl+Shift+J") );
	connect(actionExecuteAll, SIGNAL(activated()), this, SLOT(executeAll()));

	actionEval = new QAction(tr("&Evaluate Expression"), this);
	actionEval->setShortcut( tr("Ctrl+Return") );
	connect(actionEval, SIGNAL(activated()), this, SLOT(evaluate()));

	actionPrint = new QAction(QPixmap(fileprint_xpm), tr("&Print"), this);
	connect(actionPrint, SIGNAL(activated()), this, SLOT(print()));

	actionImport = new QAction(tr("&Import..."), this);
	actionImport->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_O));
	connect(actionImport, SIGNAL(activated()), this, SLOT(importASCII()));

	QShortcut *accelImport = new QShortcut(actionImport->shortcut(), this);
	connect(accelImport, SIGNAL(activated()), this, SLOT(importASCII()));

	actionSave = new QAction(QPixmap(filesave_xpm), tr("&Save"), this);
	actionSave->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_S));
	connect(actionSave, SIGNAL(activated()), this, SLOT(save()));

	QShortcut *accelSave = new QShortcut(actionSave->shortcut(), this);
	connect(accelSave, SIGNAL(activated()), this, SLOT(save()));

	actionExport = new QAction(QIcon(QPixmap(filesaveas_xpm)), tr("Sa&ve as..."), this);
	connect(actionExport, SIGNAL(activated()), this, SLOT(exportASCII()));

	actionFind = new QAction(QPixmap(find_xpm), tr("&Find..."), this);
	actionFind->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_F));
	connect(actionFind, SIGNAL(activated()), this, SLOT(showFindDialog()));

	QShortcut *accelFind = new QShortcut(actionFind->shortcut(), this);
	connect(accelFind, SIGNAL(activated()), this, SLOT(showFindDialog()));

	actionReplace = new QAction(tr("&Replace..."), this);
	actionReplace->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_R));
	connect(actionReplace, SIGNAL(activated()), this, SLOT(replace()));

	QShortcut *accelReplace = new QShortcut(actionReplace->shortcut(), this);
	connect(accelReplace, SIGNAL(activated()), this, SLOT(replace()));

	actionFindNext = new QAction(tr("&Find next"), this);
	actionFindNext->setShortcut(QKeySequence(Qt::Key_F3));
	connect(actionFindNext, SIGNAL(activated()), this, SLOT(findNext()));

	QShortcut *accelFindNext = new QShortcut(actionFindNext->shortcut(), this);
	connect(accelFindNext, SIGNAL(activated()), this, SLOT(findNext()));

	actionFindPrevious = new QAction(tr("&Find previous"), this);
	actionFindPrevious->setShortcut(QKeySequence(Qt::Key_F4));
	connect(actionFindPrevious, SIGNAL(activated()), this, SLOT(findPrevious()));

	QShortcut *accelFindPrevious = new QShortcut(actionFindPrevious->shortcut(), this);
	connect(accelFindPrevious, SIGNAL(activated()), this, SLOT(findPrevious()));

	functionsMenu = new QMenu(this);
	Q_CHECK_PTR(functionsMenu);
	connect(functionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(insertFunction(QAction *)));
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:91,代码来源:ScriptEdit.cpp

示例12: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ArrayInit();

    QFile file;//загрузка jquery и добавление ноу конфликт
    file.setFileName(":/jquery-1.11.3.min.js");
    file.open(QIODevice::ReadOnly);
    jQuery = file.readAll();
    jQuery.append("\nvar qt = { 'jQuery': jQuery.noConflict(true) };");
    file.close();

    ServIP="127.0.0.1";


    QFile htmlF;//подгрузка html
    htmlF.setFileName(":/page.html");
    htmlF.open(QFile::ReadOnly);
    Html = htmlF.readAll();
    htmlF.close();

    QFile styleF;//подгрузка стилей
    styleF.setFileName("://style.qss");
    styleF.open(QFile::ReadOnly);
    QString qssStr = styleF.readAll();
    qApp->setStyleSheet(qssStr);
    styleF.close();

     QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
     QWebSettings::globalSettings()->setAttribute(QWebSettings::AutoLoadImages, true);
     QWebSettings::globalSettings()->setAttribute(QWebSettings::JavascriptEnabled, true);
     connect(ui->webView,SIGNAL(loadFinished(bool)),this,SLOT(UIloadFinished(bool)));
     ui->webView->load(QUrl("http://free-filmy.ru/"));

    connect(this,SIGNAL (phase2(QString)),this ,SLOT(Phase2Do(QString)));
    wb1=new QWebView();
    connect(wb1,SIGNAL(loadFinished(bool)),this,SLOT(loadFinished(bool)));
    connect(wb1,SIGNAL(loadProgress(int)),this, SLOT(changeProgress(int)));
    wb2=new QWebView();
    connect(wb2,SIGNAL(loadFinished(bool)),this,SLOT(loadFinished2(bool)));

    dial=new QDialog;
    wb3=new QWebView();
    pb=new QPushButton();
    pb->setText("OK");
    VBox=new QVBoxLayout;
    VBox->addWidget(wb3);
    VBox->addWidget(pb);
    HBox=new QHBoxLayout;
    HBox->addLayout(VBox);
    dial->setLayout(HBox);

    dial2=new QDialog;
    wb4=new QWebView();
    VBox2=new QVBoxLayout;
    VBox2->addWidget(wb4);
    HBox2=new QHBoxLayout;
    HBox2->addLayout(VBox2);
    dial2->setLayout(HBox2);


  connect(pb,SIGNAL(clicked(bool)),this,SLOT(pb_click(bool)));
  connect(wb3->page()->mainFrame(),SIGNAL(titleChanged(QString)),this,SLOT(img_put(QString)));

  done2=true;

}
开发者ID:ksand77,项目名称:freeclient,代码行数:69,代码来源:mainwindow.cpp

示例13: LOG_TRACE

void ProxyAction::changeContexts(QList<int> contexts)
{
    LOG_TRACE("Context update request on proxy action", text());

    if (m_contextActions.isEmpty())
    {
        LOG_TRACE("No backend actions stored here.");
        return;
    }

    m_contexts = contexts;

    QAction *oldAction = m_activeAction;
    m_activeAction = 0;

    for (int n = 0; n < m_contexts.size(); n++)
    {
        QAction *a = m_contextActions.value(m_contexts.at(n), 0);
        if (a)
        {
            m_activeAction = a;
            m_activeAction->setObjectName(a->text());

            LOG_TRACE(QString("Backend action found: %1, shortcut: %2, proxy shortcut: %3")
                      .arg(m_activeAction->text())
                      .arg(m_activeAction->shortcut().toString())
                      .arg(m_action->shortcut().toString()));
            break;
        }
    }

    if (m_activeAction == oldAction && m_initialized)
    {
        updateFrontend();

        LOG_TRACE("New backend action is the same as the active action; nothing to be done.");
        return;
    }

    if (oldAction)
    {
        LOG_TRACE(QString("Disconnecting multi-context action from previous backend action in parent: %1")
                  .arg(oldAction->parent() ? oldAction->parent()->objectName() : "Unspecified parent"));

        disconnect(oldAction, SIGNAL(changed()), this, SLOT(updateFrontend()));
        disconnect(m_action, SIGNAL(triggered(bool)), oldAction, SIGNAL(triggered(bool)));
        disconnect(m_action, SIGNAL(toggled(bool)), oldAction, SLOT(setChecked(bool)));
    }

    if (m_activeAction)
    {
        LOG_TRACE(QString("Connecting base action: %1, shortcut: %2, parent: %3")
                  .arg(m_activeAction->text())
                  .arg(m_action->shortcut().toString())
                  .arg(m_activeAction->parent() ? m_activeAction->parent()->objectName() : "Unspecified parent"));

        connect(m_activeAction, SIGNAL(changed()), SLOT(updateFrontend()));
        connect(m_action, SIGNAL(triggered(bool)), m_activeAction, SIGNAL(triggered(bool)));
        connect(m_action, SIGNAL(toggled(bool)), m_activeAction, SLOT(setChecked(bool)));

        updateFrontend();

        m_initialized = true;

        return;
    }
    else
    {
        LOG_TRACE("New backend action could not be found; action will be disabled in this context.");
    }

    m_action->setEnabled(false);
}
开发者ID:jkdoug,项目名称:mudder,代码行数:73,代码来源:proxyaction.cpp

示例14: QDialog

AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AddressBookPage),
    model(0),
    mode(mode),
    tab(tab)
{
    ui->setupUi(this);

#ifdef Q_WS_MAC // Icons on push buttons are very uncommon on Mac
    ui->newAddressButton->setIcon(QIcon());
    ui->copyToClipboard->setIcon(QIcon());
    ui->deleteButton->setIcon(QIcon());
#endif

#ifndef USE_QRCODE
    ui->showQRCode->setVisible(false);
#endif

    switch(mode)
    {
    case ForSending:
        connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept()));
        ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
        ui->tableView->setFocus();
        break;
    case ForEditing:
        ui->buttonBox->setVisible(false);
        break;
    }
    switch(tab)
    {
    case SendingTab:
        ui->labelExplanation->setVisible(false);
        ui->deleteButton->setVisible(true);
        ui->signMessage->setVisible(false);
        break;
    case ReceivingTab:
        ui->deleteButton->setVisible(false);
        ui->signMessage->setVisible(true);
        break;
    }
    ui->tableView->setTabKeyNavigation(false);
    ui->tableView->setContextMenuPolicy(Qt::CustomContextMenu);

    // Context menu actions
    QAction *copyAddressAction = new QAction(tr("Copy address"), this);
    QAction *copyLabelAction = new QAction(tr("Copy label"), this);
    QAction *editAction = new QAction(tr("Edit"), this);
    deleteAction = new QAction(tr("Delete"), this);

    contextMenu = new QMenu();
    contextMenu->addAction(copyAddressAction);
    contextMenu->addAction(copyLabelAction);
    contextMenu->addAction(editAction);
    contextMenu->addAction(deleteAction);

    connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(on_copyToClipboard_clicked()));
    connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(onCopyLabelAction()));
    connect(editAction, SIGNAL(triggered()), this, SLOT(onEditAction()));
    connect(deleteAction, SIGNAL(triggered()), this, SLOT(on_deleteButton_clicked()));

    connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));

    // Pass through accept action from button box
    connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
}
开发者ID:19RuslanD67,项目名称:novacoin,代码行数:67,代码来源:addressbookpage.cpp

示例15: QDialog

optionsDialog::optionsDialog(QWidget *parent, std::string name)
    : QDialog(parent)
{
    zoomLabel = new QLabel(tr("Zoom factor"));
    delayLabel = new QLabel(tr("Delay factor"));
    generationLabel = new QLabel(tr("Generation:"));
    numberLabel = new QLabel(tr("0"));

    zoomSB = new QSpinBox;
    zoomSB->setRange(1,30);
    delaySB = new QSpinBox;
    delaySB->setRange(1,10000);

    zoomSlid = new QSlider(Qt::Horizontal);
    zoomSlid->setRange(1,30);
    QObject::connect(zoomSB, SIGNAL(valueChanged(int)),
                     zoomSlid, SLOT(setValue(int)));
    QObject::connect(zoomSlid, SIGNAL(valueChanged(int)),
                     zoomSB, SLOT(setValue(int)));
    QObject::connect(zoomSB, SIGNAL(valueChanged(int)),
                     parent, SLOT(zoomChanged(int)));
    zoomSB->setValue(10);
    

    delaySlid = new QSlider(Qt::Horizontal);
    delaySlid->setRange(1,10000);
    QObject::connect(delaySB, SIGNAL(valueChanged(int)),
                     delaySlid, SLOT(setValue(int)));
    QObject::connect(delaySlid, SIGNAL(valueChanged(int)),
                     delaySB, SLOT(setValue(int)));
    QObject::connect(delaySB, SIGNAL(valueChanged(int)),
                     parent, SLOT(delayChanged(int)));
    delaySB->setValue(100);

    quitButton = new QPushButton(tr("&Quit"));
    playButton = new QPushButton(tr("&Play"));
    stepButton = new QPushButton(tr("&Step"));
    QObject::connect(quitButton, SIGNAL(clicked()),
            parent, SLOT(quitClicked()));
    QObject::connect(stepButton, SIGNAL(clicked()),
            parent, SLOT(stepClicked()));
    QObject::connect(playButton, SIGNAL(clicked()),
            parent, SLOT(playClicked()));


    QHBoxLayout *zoomLayout = new QHBoxLayout;
    zoomLayout->addWidget(zoomLabel);
    zoomLayout->addWidget(zoomSB);
    zoomLayout->addWidget(zoomSlid);

    QHBoxLayout *delayLayout = new QHBoxLayout;
    delayLayout->addWidget(delayLabel);
    delayLayout->addWidget(delaySB);
    delayLayout->addWidget(delaySlid);

    QHBoxLayout *generationLayout = new QHBoxLayout;
    generationLayout->addWidget(generationLabel);
    generationLayout->addStretch();
    generationLayout->addWidget(numberLabel);
    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->addWidget(quitButton);
    buttonLayout->addWidget(playButton);
    buttonLayout->addWidget(stepButton);
    
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addLayout(zoomLayout);
    mainLayout->addLayout(delayLayout);
    mainLayout->addLayout(generationLayout);
    mainLayout->addLayout(buttonLayout);
    setLayout(mainLayout);

    QString *title = new QString((name + " Controls").c_str());
    setWindowTitle(*title);
    setFixedHeight(sizeHint().height());
}
开发者ID:rascheel,项目名称:coms229-project2,代码行数:75,代码来源:optionsdialog.cpp


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