本文整理汇总了C++中QActionGroup类的典型用法代码示例。如果您正苦于以下问题:C++ QActionGroup类的具体用法?C++ QActionGroup怎么用?C++ QActionGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QActionGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
PTeraStitcher::PTeraStitcher(QWidget *parent) : QMainWindow(parent)
{
#ifdef TSP_DEBUG
printf("TeraStitcher plugin [thread %d] >> PTeraStitcher created\n", this->thread()->currentThreadId());
#endif
//initializing members
parentWidget = parent;
fileMenu = menuBar()->addMenu("File");
closeVolumeAction = new QAction("Close volume", this);
closeVolumeAction->setIcon(QIcon(":/icons/close.png"));
closeVolumeAction->setShortcut(QKeySequence("Ctrl+C"));
connect(closeVolumeAction, SIGNAL(triggered()), this, SLOT(closeVolumeTriggered()));
fileMenu->addAction(closeVolumeAction);
exitAction = new QAction("Quit", this);
exitAction->setShortcut(QKeySequence("Ctrl+Q"));
fileMenu->addAction(exitAction);
connect(exitAction, SIGNAL(triggered()), this, SLOT(exit()));
optionsMenu = menuBar()->addMenu("Options");
modeOptionsMenu = optionsMenu->addMenu("Mode");
QActionGroup* modeSelectionGroup = new QActionGroup(this);
modeSelectionGroup->setExclusive(true);
modeBasicAction = new QAction("Basic", this);
modeAdvancedAction = new QAction("Advanced", this);
modeBasicAction->setCheckable(true);
modeAdvancedAction->setCheckable(true);
modeAdvancedAction->setChecked(true);
modeSelectionGroup->addAction(modeBasicAction);
modeSelectionGroup->addAction(modeAdvancedAction);
modeOptionsMenu->addAction(modeBasicAction);
modeOptionsMenu->addAction(modeAdvancedAction);
connect(modeBasicAction, SIGNAL(changed()), this, SLOT(modeChanged()));
connect(modeAdvancedAction, SIGNAL(changed()), this, SLOT(modeChanged()));
helpMenu = menuBar()->addMenu("Help");
aboutAction = new QAction("About", this);
aboutAction->setIcon(QIcon(":/icons/about.png"));
helpMenu->addAction(aboutAction);
connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
// connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
//creating widgets
tabs = new QMyTabWidget();
tabImport = PTabImport::instance(tabs, 0);
tabDisplComp = PTabDisplComp::instance(tabs, 1);
tabDisplComp->setEnabled(false);
tabDisplProj = PTabDisplProj::instance(tabs, 2);
tabDisplProj->setEnabled(false);
tabDisplThres = PTabDisplThresh::instance(tabs, 3);
tabDisplThres->setEnabled(false);
tabPlaceTiles = PTabPlaceTiles::instance(tabs, 4);
tabPlaceTiles->setEnabled(false);
#ifdef VAA3D_TERASTITCHER
tabMergeTiles = PTabMergeTiles::instance(tabs, 5, V3D_env);
#else
tabMergeTiles = PTabMergeTiles::instance(tabs, 5);
#endif
tabMergeTiles->setEnabled(false);
tabs->addTab(tabImport, tr("Import"));
tabs->addTab(tabDisplComp, tr("Align"));
tabs->addTab(tabDisplProj, tr("Project"));
tabs->addTab(tabDisplThres, tr("Threshold"));
tabs->addTab(tabPlaceTiles, tr("Place"));
tabs->addTab(tabMergeTiles, tr("Merge"));
tabs->setTabIcon(0, QIcon(":/icons/number1.png"));
tabs->setTabIcon(1, QIcon(":/icons/number2.png"));
tabs->setTabIcon(2, QIcon(":/icons/number3.png"));
tabs->setTabIcon(3, QIcon(":/icons/number4.png"));
tabs->setTabIcon(4, QIcon(":/icons/number5.png"));
tabs->setTabIcon(5, QIcon(":/icons/number6.png"));
progressBar = new QProgressBar(this);
startButton = new QPushButton(this);
startButton->setIcon(QIcon(":/icons/start.png"));
startButton->setText("Start");
/*startAllButton = new QPushButton(this);
startAllButton->setIcon(QIcon(":/icons/startall.png"));
startAllButton->setText("Start all");*/
stopButton = new QPushButton(this);
stopButton->setIcon(QIcon(":/icons/stop.png"));
stopButton->setText("Stop");
statusBar()->showMessage("Ready.");
//statusBar()->setFont(QFont("",8));
//helpBox = new QHelpBox(this);
//helpBox->setDefaultMessage("<b>What's this?</b><br><i>Move the mouse over an object and its description will be displayed here.</i>");
//layout
QHBoxLayout* bottomBar = new QHBoxLayout();
bottomBar->addWidget(progressBar, 1);
bottomBar->addWidget(startButton);
bottomBar->addWidget(stopButton);
//bottomBar->setContentsMargins(5,0,5,5);
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget(tabs, 1);
//helpBox->setFixedHeight(100);
//QGridLayout *helpBoxLayout = new QGridLayout();
// helpBoxLayout->addWidget(helpBox, 0, 0);
//.........这里部分代码省略.........
示例2: QActionGroup
void BitcoinGUI::createActions()
{
QActionGroup *tabGroup = new QActionGroup(this);
overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this);
overviewAction->setToolTip(tr("Show general overview of wallet"));
overviewAction->setCheckable(true);
overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
tabGroup->addAction(overviewAction);
miningAction = new QAction(QIcon(":/icons/mining"), tr("&Mining"), this);
miningAction->setToolTip(tr("Configure mining"));
miningAction->setCheckable(true);
//tabGroup->addAction(miningAction);
historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
historyAction->setToolTip(tr("Browse transaction history"));
historyAction->setCheckable(true);
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);
addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this);
addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels"));
addressBookAction->setCheckable(true);
addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
tabGroup->addAction(addressBookAction);
receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments"));
receiveCoinsAction->setCheckable(true);
receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
tabGroup->addAction(receiveCoinsAction);
sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
sendCoinsAction->setToolTip(tr("Send coins to a Geotoken address"));
sendCoinsAction->setCheckable(true);
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(sendCoinsAction);
signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this);
signMessageAction->setToolTip(tr("Sign a message to prove you own a Bitcoin address"));
tabGroup->addAction(signMessageAction);
verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this);
verifyMessageAction->setToolTip(tr("Verify a message to ensure it was signed with a specified Bitcoin address"));
tabGroup->addAction(verifyMessageAction);
#ifdef FIRST_CLASS_MESSAGING
firstClassMessagingAction = new QAction(QIcon(":/icons/edit"), tr("S&ignatures"), this);
firstClassMessagingAction->setToolTip(signMessageAction->toolTip() + QString(". / ") + verifyMessageAction->toolTip() + QString("."));
firstClassMessagingAction->setCheckable(true);
tabGroup->addAction(firstClassMessagingAction);
#endif
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
connect(miningAction, SIGNAL(triggered()), this, SLOT(gotoMiningPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
#ifdef FIRST_CLASS_MESSAGING
connect(firstClassMessagingAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
// Always start with the sign message tab for FIRST_CLASS_MESSAGING
connect(firstClassMessagingAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
#endif
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setToolTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
quitAction->setMenuRole(QAction::QuitRole);
aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About Geotoken"), this);
aboutAction->setToolTip(tr("Show information about Geotoken"));
aboutAction->setMenuRole(QAction::AboutRole);
aboutQtAction = new QAction(tr("About &Qt"), this);
aboutQtAction->setToolTip(tr("Show information about Qt"));
aboutQtAction->setMenuRole(QAction::AboutQtRole);
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
optionsAction->setToolTip(tr("Modify configuration options for Geotoken"));
optionsAction->setMenuRole(QAction::PreferencesRole);
toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("Show/Hide &Geotoken"), this);
toggleHideAction->setToolTip(tr("Show or hide the Geotoken window"));
exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
exportAction->setToolTip(tr("Export the data in the current tab to a file"));
encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet"));
encryptWalletAction->setCheckable(true);
backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this);
backupWalletAction->setToolTip(tr("Backup wallet to another location"));
changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this);
changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption"));
openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this);
//.........这里部分代码省略.........
示例3: QActionGroup
void BitcoinGUI::createActions()
{
QActionGroup *tabGroup = new QActionGroup(this);
overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this);
overviewAction->setToolTip(tr("Show general overview of wallet"));
overviewAction->setCheckable(true);
overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
tabGroup->addAction(overviewAction);
sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
sendCoinsAction->setToolTip(tr("Send coins to a FlavorCoin address"));
sendCoinsAction->setCheckable(true);
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(sendCoinsAction);
receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments"));
receiveCoinsAction->setCheckable(true);
receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
tabGroup->addAction(receiveCoinsAction);
historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
historyAction->setToolTip(tr("Browse transaction history"));
historyAction->setCheckable(true);
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);
addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this);
addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels"));
addressBookAction->setCheckable(true);
addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
tabGroup->addAction(addressBookAction);
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setToolTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
quitAction->setMenuRole(QAction::QuitRole);
aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About FlavorCoin"), this);
aboutAction->setToolTip(tr("Show information about FlavorCoin"));
aboutAction->setMenuRole(QAction::AboutRole);
aboutQtAction = new QAction(QIcon(":/icons/qtlogo-64"), tr("About &Qt"), this);
aboutQtAction->setToolTip(tr("Show information about Qt"));
aboutQtAction->setMenuRole(QAction::AboutQtRole);
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
optionsAction->setToolTip(tr("Modify configuration options for FlavorCoin"));
optionsAction->setMenuRole(QAction::PreferencesRole);
toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Show / Hide"), this);
encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet"));
encryptWalletAction->setCheckable(true);
backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this);
backupWalletAction->setToolTip(tr("Backup wallet to another location"));
changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this);
changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption"));
unlockWalletAction = new QAction(QIcon(":/icons/lock_open"), tr("&Unlock Wallet..."), this);
unlockWalletAction->setToolTip(tr("Unlock wallet"));
lockWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Lock Wallet"), this);
lockWalletAction->setToolTip(tr("Lock wallet"));
signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this);
verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this);
exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
exportAction->setToolTip(tr("Export the data in the current tab to a file"));
openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this);
openRPCConsoleAction->setToolTip(tr("Open debugging and diagnostic console"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool)));
connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet()));
connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase()));
connect(unlockWalletAction, SIGNAL(triggered()), this, SLOT(unlockWallet()));
connect(lockWalletAction, SIGNAL(triggered()), this, SLOT(lockWallet()));
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
}
示例4: QWidget
MainWindow::MainWindow( QWidget *parent )
: QWidget( parent )
, cardsGroup( new QActionGroup( this ) )
{
setAttribute( Qt::WA_DeleteOnClose, true );
setupUi( this );
cards->hide();
cards->hack();
languages->hack();
setWindowFlags( Qt::Window | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint );
#if QT_VERSION >= 0x040500
setWindowFlags( windowFlags() | Qt::WindowCloseButtonHint );
#else
setWindowFlags( windowFlags() | Qt::WindowSystemMenuHint );
#endif
// Buttons
QButtonGroup *buttonGroup = new QButtonGroup( this );
buttonGroup->addButton( settings, HeadSettings );
buttonGroup->addButton( help, HeadHelp );
buttonGroup->addButton( about, HeadAbout );
buttonGroup->addButton( homeCreate, HomeCreate );
buttonGroup->addButton( homeView, HomeView );
introNext = introButtons->addButton( tr( "Next" ), QDialogButtonBox::ActionRole );
buttonGroup->addButton( introNext, IntroNext );
buttonGroup->addButton( introButtons->button( QDialogButtonBox::Cancel ), IntroBack );
viewCrypt = viewButtons->addButton( tr("Encrypt"), QDialogButtonBox::ActionRole );
buttonGroup->addButton( viewCrypt, ViewCrypt );
buttonGroup->addButton( viewButtons->button( QDialogButtonBox::Close ), ViewClose );
connect( buttonGroup, SIGNAL(buttonClicked(int)),
SLOT(buttonClicked(int)) );
connect( cards, SIGNAL(activated(QString)), qApp->poller(), SLOT(selectCard(QString)), Qt::QueuedConnection );
connect( qApp->poller(), SIGNAL(dataChanged()), SLOT(showCardStatus()) );
// Cryptodoc
doc = new CryptoDoc( this );
// Translations
lang << "et" << "en" << "ru";
retranslate();
QActionGroup *langGroup = new QActionGroup( this );
for( int i = 0; i < lang.size(); ++i )
{
QAction *a = langGroup->addAction( new QAction( langGroup ) );
a->setData( lang[i] );
a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_0 + i );
}
addActions( langGroup->actions() );
connect( langGroup, SIGNAL(triggered(QAction*)), SLOT(changeLang(QAction*)) );
connect( cardsGroup, SIGNAL(triggered(QAction*)), SLOT(changeCard(QAction*)) );
// Views
connect( viewContentView, SIGNAL(remove(int)),
SLOT(removeDocument(int)) );
connect( viewContentView, SIGNAL(save(int,QString)),
doc, SLOT(saveDocument(int,QString)) );
}
示例5: QActionGroup
void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
{
QActionGroup *tabGroup = new QActionGroup(this);
overviewAction = new QAction(SingleColorIcon(":/icons/overview"), tr("&Overview"), this);
overviewAction->setStatusTip(tr("Show general overview of wallet"));
overviewAction->setToolTip(overviewAction->statusTip());
overviewAction->setCheckable(true);
overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
tabGroup->addAction(overviewAction);
sendCoinsAction = new QAction(SingleColorIcon(":/icons/send"), tr("&Send"), this);
sendCoinsAction->setStatusTip(tr("Send coins to a Chikun address"));
sendCoinsAction->setToolTip(sendCoinsAction->statusTip());
sendCoinsAction->setCheckable(true);
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(sendCoinsAction);
sendCoinsMenuAction = new QAction(TextColorIcon(":/icons/send"), sendCoinsAction->text(), this);
sendCoinsMenuAction->setStatusTip(sendCoinsAction->statusTip());
sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip());
receiveCoinsAction = new QAction(SingleColorIcon(":/icons/receiving_addresses"), tr("&Receive"), this);
receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and chikun: URIs)"));
receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip());
receiveCoinsAction->setCheckable(true);
receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
tabGroup->addAction(receiveCoinsAction);
receiveCoinsMenuAction = new QAction(TextColorIcon(":/icons/receiving_addresses"), receiveCoinsAction->text(), this);
receiveCoinsMenuAction->setStatusTip(receiveCoinsAction->statusTip());
receiveCoinsMenuAction->setToolTip(receiveCoinsMenuAction->statusTip());
historyAction = new QAction(SingleColorIcon(":/icons/history"), tr("&Transactions"), this);
historyAction->setStatusTip(tr("Browse transaction history"));
historyAction->setToolTip(historyAction->statusTip());
historyAction->setCheckable(true);
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);
#ifdef ENABLE_WALLET
// These showNormalIfMinimized are needed because Send Coins and Receive Coins
// can be triggered from the tray menu, and need to show the GUI to be useful.
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
#endif // ENABLE_WALLET
quitAction = new QAction(TextColorIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setStatusTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
quitAction->setMenuRole(QAction::QuitRole);
aboutAction = new QAction(TextColorIcon(":/icons/about"), tr("&About KUN KORE"), this);
aboutAction->setStatusTip(tr("Show information about KUN KORE"));
aboutAction->setMenuRole(QAction::AboutRole);
aboutQtAction = new QAction(TextColorIcon(":/icons/about_qt"), tr("About &Qt"), this);
aboutQtAction->setStatusTip(tr("Show information about Qt"));
aboutQtAction->setMenuRole(QAction::AboutQtRole);
optionsAction = new QAction(TextColorIcon(":/icons/options"), tr("&Options..."), this);
optionsAction->setStatusTip(tr("Modify configuration options for KUN KORE"));
optionsAction->setMenuRole(QAction::PreferencesRole);
toggleHideAction = new QAction(TextColorIcon(":/icons/about"), tr("&Show / Hide"), this);
toggleHideAction->setStatusTip(tr("Show or hide the main Window"));
encryptWalletAction = new QAction(TextColorIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet"));
encryptWalletAction->setCheckable(true);
backupWalletAction = new QAction(TextColorIcon(":/icons/filesave"), tr("&Backup Wallet..."), this);
backupWalletAction->setStatusTip(tr("Backup wallet to another location"));
changePassphraseAction = new QAction(TextColorIcon(":/icons/key"), tr("&Change Passphrase..."), this);
changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption"));
signMessageAction = new QAction(TextColorIcon(":/icons/edit"), tr("Sign &message..."), this);
signMessageAction->setStatusTip(tr("Sign messages with your Chikun addresses to prove you own them"));
verifyMessageAction = new QAction(TextColorIcon(":/icons/verify"), tr("&Verify message..."), this);
verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Chikun addresses"));
openRPCConsoleAction = new QAction(TextColorIcon(":/icons/debugwindow"), tr("&Debug window"), this);
openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console"));
usedSendingAddressesAction = new QAction(TextColorIcon(":/icons/address-book"), tr("&Sending addresses..."), this);
usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels"));
usedReceivingAddressesAction = new QAction(TextColorIcon(":/icons/address-book"), tr("&Receiving addresses..."), this);
usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels"));
openAction = new QAction(TextColorIcon(":/icons/open"), tr("Open &URI..."), this);
openAction->setStatusTip(tr("Open a bitcoin: URI or payment request"));
showHelpMessageAction = new QAction(TextColorIcon(":/icons/info"), tr("&Command-line options"), this);
showHelpMessageAction->setStatusTip(tr("Show the KUN KORE help message to get a list with possible Chikun command-line options"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
//.........这里部分代码省略.........
示例6: fileLoaded_
ViewerWindow::ViewerWindow():
fileLoaded_(false){
setupUi( this );
#ifdef WIN32
//Reposition console window
QRect myRegion=frameGeometry();
QPoint putAt=myRegion.topRight();
SetWindowPos(GetConsoleWindow(),winId(),putAt.x()+1,putAt.y(),0,0,SWP_NOSIZE);
#endif
mProdconn.ConnectConsumer( mViewer->InputPort()[0] );
mViewer->SetColorTransformType( M4D::GUI::ctTransferFunction1D );
action2D->setChecked(true);
//---TF Editor---
std::vector<M4D::GUI::TF::Size> dataCT1D(1, 4096); //default CT
editingSystem_ = M4D::GUI::TFPalette::Ptr(new M4D::GUI::TFPalette(this, dataCT1D));
editingSystem_->setupDefault();
bool previewUpdateConnected = QObject::connect(&(*editingSystem_), SIGNAL(UpdatePreview(M4D::GUI::TF::Size)),
this, SLOT(updatePreview(M4D::GUI::TF::Size)));
tfAssert(previewUpdateConnected);
QDockWidget* dockWidget = new QDockWidget("Transfer Function Palette", this);
dockWidget->setWidget( &(*editingSystem_) );
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
dockWidget->setAllowedAreas(Qt::AllDockWidgetAreas);
addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
dockWidget->setFloating(true);
//---Timer---
changeChecker_.setInterval( 500 );
QObject::connect( &changeChecker_, SIGNAL( timeout() ), this, SLOT( updateTransferFunction() ) );
//---Viewer Switch---
QActionGroup *viewerTypeSwitch = new QActionGroup( this );
QSignalMapper *viewerTypeSwitchSignalMapper = new QSignalMapper( this );
viewerTypeSwitch->setExclusive( true );
viewerTypeSwitch->addAction( action2D );
viewerTypeSwitch->addAction( action3D );
viewerTypeSwitchSignalMapper->setMapping( action2D, M4D::GUI::rt2DAlignedSlices );
viewerTypeSwitchSignalMapper->setMapping( action3D, M4D::GUI::rt3D );
QObject::connect( action2D, SIGNAL( triggered() ), viewerTypeSwitchSignalMapper, SLOT( map() ) );
QObject::connect( action3D, SIGNAL( triggered() ), viewerTypeSwitchSignalMapper, SLOT( map() ) );
QObject::connect( viewerTypeSwitchSignalMapper, SIGNAL( mapped ( int ) ), this, SLOT( changeViewerType( int ) ) );
//---Mouse info---
QLabel *infoLabel = new QLabel();
statusbar->addWidget( infoLabel );
mViewer->setMouseTracking ( true );
QObject::connect( mViewer, SIGNAL( MouseInfoUpdate( const QString & ) ), infoLabel, SLOT( setText( const QString & ) ) );
//---Default buffer---
buffer_ = Buffer1D::Ptr(new Buffer1D(4096, Interval(0.0f, 4095.0f)));
#ifdef TF_NDEBUG
showMaximized();
#endif
#ifndef TF_NDEBUG
show();
#endif
//show must be called before setting transfer function buffer
mViewer->SetTransferFunctionBuffer(buffer_);
}
示例7: resize
//.........这里部分代码省略.........
currentAction = new QAction(tr("Rename"), this);
currentAction->setStatusTip(tr("Rename the current program"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(rename()));
currentMenu->addAction(currentAction);
currentAction = new QAction(tr("Duplicate tab"), this);
currentAction->setStatusTip(tr("Copies the current program into a new tab"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(duplicateTab()));
currentMenu->addAction(currentAction);
currentMenu->addSeparator();
currentAction = new QAction(tr("Remove tab"), this);
currentAction->setShortcut(tr("Ctrl+W"));
currentAction->setStatusTip(tr("Remove the current program from the sketch"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(closeCurrentTab()));
currentMenu->addAction(currentAction);
currentMenu->addSeparator();
m_printAction = new QAction(tr("&Print..."), this);
m_printAction->setShortcut(tr("Ctrl+P"));
m_printAction->setStatusTip(tr("Print the current program"));
connect(m_printAction, SIGNAL(triggered()), this, SLOT(print()));
currentMenu->addAction(m_printAction);
currentMenu->addSeparator();
currentAction = new QAction(tr("&Quit"), this);
currentAction->setShortcut(tr("Ctrl+Q"));
currentAction->setStatusTip(tr("Quit the application"));
currentAction->setMenuRole(QAction::QuitRole);
connect(currentAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows2()));
currentMenu->addAction(currentAction);
currentMenu = menubar->addMenu(tr("&Edit"));
m_undoAction = new QAction(tr("Undo"), this);
m_undoAction->setShortcuts(QKeySequence::Undo);
m_undoAction->setEnabled(false);
connect(m_undoAction, SIGNAL(triggered()), this, SLOT(undo()));
currentMenu->addAction(m_undoAction);
m_redoAction = new QAction(tr("Redo"), this);
m_redoAction->setShortcuts(QKeySequence::Redo);
m_redoAction->setEnabled(false);
connect(m_redoAction, SIGNAL(triggered()), this, SLOT(redo()));
currentMenu->addAction(m_redoAction);
currentMenu->addSeparator();
m_cutAction = new QAction(tr("&Cut"), this);
m_cutAction->setShortcut(tr("Ctrl+X"));
m_cutAction->setStatusTip(tr("Cut selection"));
m_cutAction->setEnabled(false);
connect(m_cutAction, SIGNAL(triggered()), this, SLOT(cut()));
currentMenu->addAction(m_cutAction);
m_copyAction = new QAction(tr("&Copy"), this);
m_copyAction->setShortcut(tr("Ctrl+C"));
m_copyAction->setStatusTip(tr("Copy selection"));
m_copyAction->setEnabled(false);
connect(m_copyAction, SIGNAL(triggered()), this, SLOT(copy()));
currentMenu->addAction(m_copyAction);
currentAction = new QAction(tr("&Paste"), this);
currentAction->setShortcut(tr("Ctrl+V"));
currentAction->setStatusTip(tr("Paste clipboard contents"));
// TODO: Check clipboard status and disable appropriately here
connect(currentAction, SIGNAL(triggered()), this, SLOT(paste()));
currentMenu->addAction(currentAction);
currentMenu->addSeparator();
currentAction = new QAction(tr("&Select All"), this);
currentAction->setShortcut(tr("Ctrl+A"));
currentAction->setStatusTip(tr("Select all text"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(selectAll()));
currentMenu->addAction(currentAction);
currentMenu = menuBar()->addMenu(tr("&Program"));
QMenu *languageMenu = new QMenu(tr("Select language"), this);
currentMenu->addMenu(languageMenu);
QString currentLanguage = settings.value("programwindow/language", "").toString();
QStringList languages = getAvailableLanguages();
QActionGroup *languageActionGroup = new QActionGroup(this);
foreach (QString language, languages) {
currentAction = new QAction(language, this);
currentAction->setCheckable(true);
m_languageActions.insert(language, currentAction);
languageActionGroup->addAction(currentAction);
languageMenu->addAction(currentAction);
if (!currentLanguage.isEmpty()) {
if (language.compare(currentLanguage) == 0) {
currentAction->setChecked(true);
}
}
}
示例8: QAction
//.........这里部分代码省略.........
loadDirAction->setShortcut(tr("Ctrl+D"));
loadDirAction->setStatusTip(tr("Load mesh files in a directory"));
connect(loadDirAction, SIGNAL(triggered()), this, SLOT(loadDir()));
loadMeshAction = new QAction(tr("Load Mesh by &File"), this);
loadMeshAction->setIcon(QIcon(":/images/loadmesh.png"));
loadMeshAction->setShortcut(tr("Ctrl+F"));
loadMeshAction->setStatusTip(tr("Load meshes by file names"));
connect(loadMeshAction, SIGNAL(triggered()), this, SLOT(loadMesh()));
addMeshAction = new QAction(tr("Add Mesh by File"), this);
addMeshAction->setIcon(QIcon(":/images/addmesh.png"));
addMeshAction->setStatusTip(tr("Add meshes by file names"));
connect(addMeshAction, SIGNAL(triggered()), this, SLOT(addMesh()));
deleteMeshAction = new QAction(tr("Delete Mesh"), this);
deleteMeshAction->setIcon(QIcon(":/images/deletemesh.png"));
deleteMeshAction->setStatusTip(tr("Delete loaded meshes"));
connect(deleteMeshAction, SIGNAL(triggered()), this, SLOT(deleteMesh()));
saveDirPlyAction = new QAction(tr("in PLY format"), this);
connect(saveDirPlyAction, SIGNAL(triggered()), this, SLOT(saveDirPly()));
saveDirStlAction = new QAction(tr("in STL format"), this);
connect(saveDirStlAction, SIGNAL(triggered()), this, SLOT(saveDirStl()));
exitAction = new QAction(tr("E&xit"), this);
exitAction->setShortcut(tr("Ctrl+Q"));
exitAction->setStatusTip(tr("Exit Mesh Viewer"));
connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
saveViewAction = new QAction(tr("Save &View"), this);
saveViewAction->setIcon(QIcon(":/images/saveview.png"));
saveViewAction->setShortcut(tr("Shift+V"));
saveViewAction->setStatusTip(tr("Save current view to a file"));
connect(saveViewAction, SIGNAL(triggered()), this, SLOT(saveView()));
frontFaceAction = new QAction(tr("&Hide Front Faces"), this);
frontFaceAction->setIcon(QIcon(":/images/hide.png"));
frontFaceAction->setShortcut(tr("Shift+H"));
frontFaceAction->setStatusTip(tr("Hide/show front faces"));
frontFaceAction->setCheckable(true);
connect(frontFaceAction, SIGNAL(triggered()), this,
SLOT(toggleFrontFace()));
smoothSurfaceAction = new QAction(tr("&Smooth Surface"), this);
smoothSurfaceAction->setShortcut(tr("Shift+S"));
smoothSurfaceAction->setStatusTip(tr("Smooth surface"));
smoothSurfaceAction->setCheckable(true);
connect(smoothSurfaceAction, SIGNAL(triggered()), this,
SLOT(setSmoothSurface()));
flatSurfaceAction = new QAction(tr("&Flat Surface"), this);
flatSurfaceAction->setShortcut(tr("Shift+F"));
flatSurfaceAction->setStatusTip(tr("Flat surface"));
flatSurfaceAction->setCheckable(true);
connect(flatSurfaceAction, SIGNAL(triggered()), this,
SLOT(setFlatSurface()));
flatLinesAction = new QAction(tr("Flat &Lines"), this);
flatLinesAction->setShortcut(tr("Shift+L"));
flatLinesAction->setStatusTip(tr("Flat surface & lines"));
flatLinesAction->setCheckable(true);
connect(flatLinesAction, SIGNAL(triggered()), this,
SLOT(setFlatLines()));
wireFrameAction = new QAction(tr("&Wire Frame"), this);
wireFrameAction->setShortcut(tr("Shift+W"));
wireFrameAction->setStatusTip(tr("Wire frame"));
wireFrameAction->setCheckable(true);
connect(wireFrameAction, SIGNAL(triggered()), this,
SLOT(setWireFrame()));
QActionGroup *meshModeGroup = new QActionGroup(this);
meshModeGroup->addAction(smoothSurfaceAction);
meshModeGroup->addAction(flatSurfaceAction);
meshModeGroup->addAction(flatLinesAction);
meshModeGroup->addAction(wireFrameAction);
smoothSurfaceAction->setChecked(true);
toggleRightDockWidgetAction = rightDockWidget->toggleViewAction();
toggleRightDockWidgetAction->setIcon(QIcon(":/images/list.png"));
infoAction = new QAction(tr("&Info"), this);
infoAction->setIcon(QIcon(":/images/info.png"));
infoAction->setShortcut(tr("Ctrl+I"));
infoAction->setStatusTip(tr("Data information"));
connect(infoAction, SIGNAL(triggered()), this,
SLOT(info()));
helpAction = new QAction(tr("&Help"), this);
helpAction->setIcon(QIcon(":/images/help.png"));
helpAction->setShortcut(tr("Ctrl+H"));
helpAction->setStatusTip(tr("Help information"));
connect(helpAction, SIGNAL(triggered()), this, SLOT(help()));
aboutAction = new QAction(tr("About"), this);
aboutAction->setStatusTip(tr("About this software"));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
}
示例9: QDesignerPropertyEditor
PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *parent, Qt::WindowFlags flags) :
QDesignerPropertyEditor(parent, flags),
m_core(core),
m_propertySheet(0),
m_currentBrowser(0),
m_treeBrowser(0),
m_propertyManager(new DesignerPropertyManager(m_core, this)),
m_dynamicGroup(0),
m_updatingBrowser(false),
m_stackedWidget(new QStackedWidget),
m_filterWidget(new FilterWidget(0, FilterWidget::LayoutAlignNone)),
m_buttonIndex(-1),
m_treeIndex(-1),
m_addDynamicAction(new QAction(createIconSet(QLatin1String("plus.png")), tr("Add Dynamic Property..."), this)),
m_removeDynamicAction(new QAction(createIconSet(QLatin1String("minus.png")), tr("Remove Dynamic Property"), this)),
m_sortingAction(new QAction(createIconSet(QLatin1String("sort.png")), tr("Sorting"), this)),
m_coloringAction(new QAction(createIconSet(QLatin1String("color.png")), tr("Color Groups"), this)),
m_treeAction(new QAction(tr("Tree View"), this)),
m_buttonAction(new QAction(tr("Drop Down Button View"), this)),
m_classLabel(new ElidingLabel),
m_sorting(false),
m_coloring(false),
m_brightness(false)
{
QVector<QColor> colors;
colors.reserve(6);
colors.push_back(QColor(255, 230, 191));
colors.push_back(QColor(255, 255, 191));
colors.push_back(QColor(191, 255, 191));
colors.push_back(QColor(199, 255, 255));
colors.push_back(QColor(234, 191, 255));
colors.push_back(QColor(255, 191, 239));
m_colors.reserve(colors.count());
const int darknessFactor = 250;
for (int i = 0; i < colors.count(); i++) {
QColor c = colors.at(i);
m_colors.push_back(qMakePair(c, c.darker(darknessFactor)));
}
QColor dynamicColor(191, 207, 255);
QColor layoutColor(255, 191, 191);
m_dynamicColor = qMakePair(dynamicColor, dynamicColor.darker(darknessFactor));
m_layoutColor = qMakePair(layoutColor, layoutColor.darker(darknessFactor));
updateForegroundBrightness();
QActionGroup *actionGroup = new QActionGroup(this);
m_treeAction->setCheckable(true);
m_treeAction->setIcon(createIconSet(QLatin1String("widgets/listview.png")));
m_buttonAction->setCheckable(true);
m_buttonAction->setIcon(createIconSet(QLatin1String("dropdownbutton.png")));
actionGroup->addAction(m_treeAction);
actionGroup->addAction(m_buttonAction);
connect(actionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotViewTriggered(QAction*)));
// Add actions
QActionGroup *addDynamicActionGroup = new QActionGroup(this);
connect(addDynamicActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotAddDynamicProperty(QAction*)));
QMenu *addDynamicActionMenu = new QMenu(this);
m_addDynamicAction->setMenu(addDynamicActionMenu);
m_addDynamicAction->setEnabled(false);
QAction *addDynamicAction = addDynamicActionGroup->addAction(tr("String..."));
addDynamicAction->setData(static_cast<int>(QVariant::String));
addDynamicActionMenu->addAction(addDynamicAction);
addDynamicAction = addDynamicActionGroup->addAction(tr("Bool..."));
addDynamicAction->setData(static_cast<int>(QVariant::Bool));
addDynamicActionMenu->addAction(addDynamicAction);
addDynamicActionMenu->addSeparator();
addDynamicAction = addDynamicActionGroup->addAction(tr("Other..."));
addDynamicAction->setData(static_cast<int>(QVariant::Invalid));
addDynamicActionMenu->addAction(addDynamicAction);
// remove
m_removeDynamicAction->setEnabled(false);
connect(m_removeDynamicAction, SIGNAL(triggered()), this, SLOT(slotRemoveDynamicProperty()));
// Configure
QAction *configureAction = new QAction(tr("Configure Property Editor"), this);
configureAction->setIcon(createIconSet(QLatin1String("configure.png")));
QMenu *configureMenu = new QMenu(this);
configureAction->setMenu(configureMenu);
m_sortingAction->setCheckable(true);
connect(m_sortingAction, SIGNAL(toggled(bool)), this, SLOT(slotSorting(bool)));
m_coloringAction->setCheckable(true);
connect(m_coloringAction, SIGNAL(toggled(bool)), this, SLOT(slotColoring(bool)));
configureMenu->addAction(m_sortingAction);
configureMenu->addAction(m_coloringAction);
#if QT_VERSION >= 0x04FF00
configureMenu->addSeparator();
configureMenu->addAction(m_treeAction);
configureMenu->addAction(m_buttonAction);
#endif
// Assemble toolbar
QToolBar *toolBar = new QToolBar;
toolBar->addWidget(m_filterWidget);
toolBar->addWidget(createDropDownButton(m_addDynamicAction));
toolBar->addAction(m_removeDynamicAction);
//.........这里部分代码省略.........
示例10: QActionGroup
void BitcoinGUI::createActions(bool fIsTestnet)
{
QActionGroup *tabGroup = new QActionGroup(this);
overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this);
overviewAction->setStatusTip(tr("Show general overview of wallet"));
overviewAction->setToolTip(overviewAction->statusTip());
overviewAction->setCheckable(true);
overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
tabGroup->addAction(overviewAction);
sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send"), this);
sendCoinsAction->setStatusTip(tr("Send coins to an IPCoin address"));
sendCoinsAction->setToolTip(sendCoinsAction->statusTip());
sendCoinsAction->setCheckable(true);
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(sendCoinsAction);
receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive"), this);
receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and ipcoin: URIs)"));
receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip());
receiveCoinsAction->setCheckable(true);
receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
tabGroup->addAction(receiveCoinsAction);
historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
historyAction->setStatusTip(tr("Browse transaction history"));
historyAction->setToolTip(historyAction->statusTip());
historyAction->setCheckable(true);
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);
// These showNormalIfMinimized are needed because Send Coins and Receive Coins
// can be triggered from the tray menu, and need to show the GUI to be useful.
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setStatusTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
quitAction->setMenuRole(QAction::QuitRole);
if (!fIsTestnet)
aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About IPCoin"), this);
else
aboutAction = new QAction(QIcon(":/icons/bitcoin_testnet"), tr("&About IPCoin"), this);
aboutAction->setStatusTip(tr("Show information about IPCoin"));
aboutAction->setMenuRole(QAction::AboutRole);
#if QT_VERSION < 0x050000
aboutQtAction = new QAction(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this);
#else
aboutQtAction = new QAction(QIcon(":/qt-project.org/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this);
#endif
aboutQtAction->setStatusTip(tr("Show information about Qt"));
aboutQtAction->setMenuRole(QAction::AboutQtRole);
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
optionsAction->setStatusTip(tr("Modify configuration options for IPCoin"));
optionsAction->setMenuRole(QAction::PreferencesRole);
if (!fIsTestnet)
toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Show / Hide"), this);
else
toggleHideAction = new QAction(QIcon(":/icons/bitcoin_testnet"), tr("&Show / Hide"), this);
toggleHideAction->setStatusTip(tr("Show or hide the main Window"));
encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet"));
encryptWalletAction->setCheckable(true);
backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this);
backupWalletAction->setStatusTip(tr("Backup wallet to another location"));
changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this);
changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption"));
signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this);
signMessageAction->setStatusTip(tr("Sign messages with your IPCoin addresses to prove you own them"));
verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this);
verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified IPCoin addresses"));
openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this);
openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console"));
usedSendingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Used sending addresses..."), this);
usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels"));
usedReceivingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("Used &receiving addresses..."), this);
usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels"));
openAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_FileIcon), tr("Open URI..."), this);
openAction->setStatusTip(tr("Open a ipcoin: URI or payment request"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
connect(encryptWalletAction, SIGNAL(triggered(bool)), walletFrame, SLOT(encryptWallet(bool)));
connect(backupWalletAction, SIGNAL(triggered()), walletFrame, SLOT(backupWallet()));
connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase()));
//.........这里部分代码省略.........
示例11: QActionGroup
void BitcoinGUI::createActions()
{
QActionGroup *tabGroup = new QActionGroup(this);
overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this);
overviewAction->setToolTip(tr("Show general overview of wallet"));
overviewAction->setCheckable(true);
overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
tabGroup->addAction(overviewAction);
historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
historyAction->setToolTip(tr("Browse transaction history"));
historyAction->setCheckable(true);
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);
addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this);
addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels"));
addressBookAction->setCheckable(true);
addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
tabGroup->addAction(addressBookAction);
receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments"));
receiveCoinsAction->setCheckable(true);
receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
tabGroup->addAction(receiveCoinsAction);
sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
sendCoinsAction->setToolTip(tr("Send coins to a bitcoin address"));
sendCoinsAction->setCheckable(true);
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(sendCoinsAction);
messageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message"), this);
messageAction->setToolTip(tr("Prove you control an address"));
#ifdef FIRST_CLASS_MESSAGING
messageAction->setCheckable(true);
#endif
tabGroup->addAction(messageAction);
connect(overviewAction, SIGNAL(triggered()), this, SLOT(show()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(show()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(show()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(show()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(show()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(messageAction, SIGNAL(triggered()), this, SLOT(show()));
connect(messageAction, SIGNAL(triggered()), this, SLOT(gotoMessagePage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setToolTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
quitAction->setMenuRole(QAction::QuitRole);
aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About %1").arg(qApp->applicationName()), this);
aboutAction->setToolTip(tr("Show information about Bitcoin"));
aboutAction->setMenuRole(QAction::AboutRole);
aboutQtAction = new QAction(tr("About &Qt"), this);
aboutQtAction->setToolTip(tr("Show information about Qt"));
aboutQtAction->setMenuRole(QAction::AboutQtRole);
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
optionsAction->setToolTip(tr("Modify configuration options for bitcoin"));
optionsAction->setMenuRole(QAction::PreferencesRole);
openBitcoinAction = new QAction(QIcon(":/icons/bitcoin"), tr("Open &Bitcoin"), this);
openBitcoinAction->setToolTip(tr("Show the Bitcoin window"));
exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
exportAction->setToolTip(tr("Export the current view to a file"));
encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet"), this);
encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet"));
encryptWalletAction->setCheckable(true);
changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase"), this);
changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(openBitcoinAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool)));
connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase()));
}
示例12: QActionGroup
void BitcoinGUI::createActions()
{
QActionGroup *tabGroup = new QActionGroup(this);
overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this);
overviewAction->setToolTip(tr("Show general overview of wallet"));
overviewAction->setCheckable(true);
overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
tabGroup->addAction(overviewAction);
historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
historyAction->setToolTip(tr("Browse transaction history"));
historyAction->setCheckable(true);
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);
mintingAction = new QAction(QIcon(":/icons/history"), tr("&Minting"), this);
mintingAction->setToolTip(tr("Show your minting capacity"));
mintingAction->setCheckable(true);
mintingAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
tabGroup->addAction(mintingAction);
addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this);
addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels"));
addressBookAction->setCheckable(true);
addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6));
tabGroup->addAction(addressBookAction);
receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments"));
receiveCoinsAction->setCheckable(true);
receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
tabGroup->addAction(receiveCoinsAction);
sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
sendCoinsAction->setToolTip(tr("Send coins to a Paycoin address"));
sendCoinsAction->setCheckable(true);
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(sendCoinsAction);
messageAction = new QAction(QIcon(":/icons/edit"), tr("Sign/Verify &message"), this);
messageAction->setToolTip(tr("Prove you control an address"));
#ifdef FIRST_CLASS_MESSAGING
messageAction->setCheckable(true);
#endif
tabGroup->addAction(messageAction);
multisigAction = new QAction(QIcon(":/icons/send"), tr("Multisig"), this);
tabGroup->addAction(multisigAction);
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(mintingAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(mintingAction, SIGNAL(triggered()), this, SLOT(gotoMintingPage()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(messageAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(messageAction, SIGNAL(triggered()), this, SLOT(gotoMessagePage()));
connect(multisigAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(multisigAction, SIGNAL(triggered()), this, SLOT(gotoMultisigPage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setToolTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
quitAction->setMenuRole(QAction::QuitRole);
aboutAction = new QAction(QIcon(":/icons/paycoin_tooltip"), tr("&About Paycoin"), this);
aboutAction->setToolTip(tr("Show information about Paycoin"));
aboutAction->setMenuRole(QAction::AboutRole);
aboutQtAction = new QAction(tr("About &Qt"), this);
aboutQtAction->setToolTip(tr("Show information about Qt"));
aboutQtAction->setMenuRole(QAction::AboutQtRole);
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
optionsAction->setToolTip(tr("Modify configuration options for Paycoin"));
optionsAction->setMenuRole(QAction::PreferencesRole);
toggleHideAction = new QAction(QIcon(":/icons/paycoin_tooltip"), tr("Show/Hide &Paycoin"), this);
toggleHideAction->setToolTip(tr("Show or hide the Paycoin window"));
exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
exportAction->setToolTip(tr("Export the data in the current tab to a file"));
encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet"), this);
encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet"));
encryptWalletAction->setCheckable(true);
unlockForMintingAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Unlock Wallet for Minting Only"), this);
unlockForMintingAction->setToolTip(tr("Unlock wallet only for minting. Sending coins will still require the passphrase."));
unlockForMintingAction->setCheckable(true);
backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet"), this);
backupWalletAction->setToolTip(tr("Backup wallet to another location"));
changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase"), this);
changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption"));
openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this);
openRPCConsoleAction->setToolTip(tr("Open debugging and diagnostic console"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
//.........这里部分代码省略.........
示例13: QMainWindow
MainWindow::MainWindow()
: QMainWindow()
, m_view(new SvgView)
{
QMenu *fileMenu = new QMenu(tr("&File"), this);
QAction *openAction = fileMenu->addAction(tr("&Open..."));
openAction->setShortcut(QKeySequence(tr("Ctrl+O")));
QAction *quitAction = fileMenu->addAction(tr("E&xit"));
quitAction->setShortcuts(QKeySequence::Quit);
menuBar()->addMenu(fileMenu);
QMenu *viewMenu = new QMenu(tr("&View"), this);
m_backgroundAction = viewMenu->addAction(tr("&Background"));
m_backgroundAction->setEnabled(false);
m_backgroundAction->setCheckable(true);
m_backgroundAction->setChecked(false);
connect(m_backgroundAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewBackground(bool)));
m_outlineAction = viewMenu->addAction(tr("&Outline"));
m_outlineAction->setEnabled(false);
m_outlineAction->setCheckable(true);
m_outlineAction->setChecked(true);
connect(m_outlineAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewOutline(bool)));
menuBar()->addMenu(viewMenu);
QMenu *rendererMenu = new QMenu(tr("&Renderer"), this);
m_nativeAction = rendererMenu->addAction(tr("&Native"));
m_nativeAction->setCheckable(true);
m_nativeAction->setChecked(true);
#ifndef QT_NO_OPENGL
m_glAction = rendererMenu->addAction(tr("&OpenGL"));
m_glAction->setCheckable(true);
#endif
m_imageAction = rendererMenu->addAction(tr("&Image"));
m_imageAction->setCheckable(true);
#ifndef QT_NO_OPENGL
rendererMenu->addSeparator();
m_highQualityAntialiasingAction = rendererMenu->addAction(tr("&High Quality Antialiasing"));
m_highQualityAntialiasingAction->setEnabled(false);
m_highQualityAntialiasingAction->setCheckable(true);
m_highQualityAntialiasingAction->setChecked(false);
connect(m_highQualityAntialiasingAction, SIGNAL(toggled(bool)), m_view, SLOT(setHighQualityAntialiasing(bool)));
#endif
QActionGroup *rendererGroup = new QActionGroup(this);
rendererGroup->addAction(m_nativeAction);
#ifndef QT_NO_OPENGL
rendererGroup->addAction(m_glAction);
#endif
rendererGroup->addAction(m_imageAction);
menuBar()->addMenu(rendererMenu);
connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(rendererGroup, SIGNAL(triggered(QAction*)),
this, SLOT(setRenderer(QAction*)));
setCentralWidget(m_view);
setWindowTitle(tr("SVG Viewer"));
}
示例14: KDialog
HgCommitDialog::HgCommitDialog(QWidget *parent):
KDialog(parent, Qt::Dialog)
{
// dialog properties
this->setCaption(i18nc("@title:window",
"<application>Hg</application> Commit"));
this->setButtons(KDialog::Ok | KDialog::Cancel);
this->setDefaultButton(KDialog::Ok);
this->setButtonText(KDialog::Ok, i18nc("@action:button", "Commit"));
this->enableButtonOk(false); // since commit message is empty when loaded
// To show diff between commit
KTextEditor::Editor *editor = KTextEditor::EditorChooser::editor();
if (!editor) {
KMessageBox::error(this,
i18n("A KDE text-editor component could not be found;"
"\nplease check your KDE installation."));
return;
}
m_fileDiffDoc = editor->createDocument(0);
m_fileDiffView = qobject_cast<KTextEditor::View*>(m_fileDiffDoc->createView(this));
m_fileDiffDoc->setReadWrite(false);
// Setup actions
m_useCurrentBranch= new KAction(this);
m_useCurrentBranch->setCheckable(true);
m_useCurrentBranch->setText(i18nc("@action:inmenu",
"Commit to current branch"));
m_newBranch = new KAction(this);
m_newBranch->setCheckable(true);
m_newBranch->setText(i18nc("@action:inmenu",
"Create new branch"));
m_closeBranch = new KAction(this);
m_closeBranch->setCheckable(true);
m_closeBranch->setText(i18nc("@action:inmenu",
"Close current branch"));
m_branchMenu = new KMenu(this);
m_branchMenu->addAction(m_useCurrentBranch);
m_branchMenu->addAction(m_newBranch);
m_branchMenu->addAction(m_closeBranch);
QActionGroup *branchActionGroup = new QActionGroup(this);
branchActionGroup->addAction(m_useCurrentBranch);
branchActionGroup->addAction(m_newBranch);
branchActionGroup->addAction(m_closeBranch);
m_useCurrentBranch->setChecked(true);
connect(branchActionGroup, SIGNAL(triggered(QAction *)),
this, SLOT(slotBranchActions(QAction *)));
//////////////
// Setup UI //
//////////////
// Top bar of buttons
QHBoxLayout *topBarLayout = new QHBoxLayout;
m_copyMessageButton = new KPushButton(i18n("Copy Message"));
m_branchButton = new KPushButton(i18n("Branch"));
m_copyMessageMenu = new KMenu(this);
createCopyMessageMenu();
topBarLayout->addWidget(new QLabel(getParentForLabel()));
topBarLayout->addStretch();
topBarLayout->addWidget(m_branchButton);
topBarLayout->addWidget(m_copyMessageButton);
m_branchButton->setMenu(m_branchMenu);
m_copyMessageButton->setMenu(m_copyMessageMenu);
// the commit box itself
QGroupBox *messageGroupBox = new QGroupBox;
QVBoxLayout *commitLayout = new QVBoxLayout;
m_commitMessage = new QPlainTextEdit;
commitLayout->addWidget(m_commitMessage);
messageGroupBox->setTitle(i18nc("@title:group", "Commit Message"));
messageGroupBox->setLayout(commitLayout);
// Show diff here
QGroupBox *diffGroupBox = new QGroupBox;
QVBoxLayout *diffLayout = new QVBoxLayout(diffGroupBox);
diffLayout->addWidget(m_fileDiffView);
diffGroupBox->setTitle(i18nc("@title:group", "Diff/Content"));
diffGroupBox->setLayout(diffLayout);
// Set up layout for Status, Commit and Diff boxes
QGridLayout *bodyLayout = new QGridLayout;
m_statusList = new HgStatusList;
bodyLayout->addWidget(m_statusList, 0, 0, 0, 1);
bodyLayout->addWidget(messageGroupBox, 0, 1);
bodyLayout->addWidget(diffGroupBox, 1, 1);
bodyLayout->setColumnStretch(0, 1);
bodyLayout->setColumnStretch(1, 2);
bodyLayout->setRowStretch(0, 1);
bodyLayout->setRowStretch(1, 1);
// Set up layout and container for main dialog
QFrame *frame = new QFrame;
//.........这里部分代码省略.........
示例15: QMenu
void CreateBlogMsg::setupTextActions()
{
QMenu *menu = new QMenu(tr("F&ormat"), this);
menuBar()->addMenu(menu);
actionTextBold = new QAction(QIcon(":/images/textedit/textbold.png"),tr("&Bold"), this);
actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
//actionTextBold->setPriority(QAction::LowPriority);
QFont bold;
bold.setBold(true);
actionTextBold->setFont(bold);
connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold()));
ui.toolBar_2->addAction(actionTextBold);
menu->addAction(actionTextBold);
actionTextBold->setCheckable(true);
actionTextItalic = new QAction(QIcon(":/images/textedit/textitalic.png"),tr("&Italic"), this);
//actionTextItalic->setPriority(QAction::LowPriority);
actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
QFont italic;
italic.setItalic(true);
actionTextItalic->setFont(italic);
connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic()));
ui.toolBar_2->addAction(actionTextItalic);
menu->addAction(actionTextItalic);
actionTextItalic->setCheckable(true);
actionTextUnderline = new QAction(QIcon(":/images/textedit/textunder.png"),tr("&Underline"), this);
actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
//actionTextUnderline->setPriority(QAction::LowPriority);
QFont underline;
underline.setUnderline(true);
actionTextUnderline->setFont(underline);
connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline()));
ui.toolBar_2->addAction(actionTextUnderline);
menu->addAction(actionTextUnderline);
actionTextUnderline->setCheckable(true);
menu->addSeparator();
QActionGroup *grp = new QActionGroup(this);
connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(textAlign(QAction*)));
// Make sure the alignLeft is always left of the alignRight
if (QApplication::isLeftToRight()) {
actionAlignLeft = new QAction(QIcon(":/images/textedit/textleft.png"),tr("&Left"), grp);
actionAlignCenter = new QAction(QIcon(":/images/textedit/textcenter.png"), tr("C&enter"), grp);
actionAlignRight = new QAction(QIcon(":/images/textedit/textright.png"), tr("&Right"), grp);
} else {
actionAlignRight = new QAction(QIcon(":/images/textedit/textright.png"), tr("&Right"), grp);
actionAlignCenter = new QAction(QIcon(":/images/textedit/textcenter.png"), tr("C&enter"), grp);
actionAlignLeft = new QAction(QIcon(":/images/textedit/textleft.png"), tr("&Left"), grp);
}
actionAlignJustify = new QAction(QIcon(":/images/textedit/textjustify.png"), tr("&Justify"), grp);
actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
actionAlignLeft->setCheckable(true);
//actionAlignLeft->setPriority(QAction::LowPriority);
actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
actionAlignCenter->setCheckable(true);
//actionAlignCenter->setPriority(QAction::LowPriority);
actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
actionAlignRight->setCheckable(true);
//actionAlignRight->setPriority(QAction::LowPriority);
actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
actionAlignJustify->setCheckable(true);
//actionAlignJustify->setPriority(QAction::LowPriority);
ui.toolBar_2->addActions(grp->actions());
menu->addActions(grp->actions());
menu->addSeparator();
QPixmap pix(16, 16);
pix.fill(Qt::black);
actionTextColor = new QAction(pix, tr("&Text Color..."), this);
connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor()));
ui.toolBar_2->addAction(actionTextColor);
menu->addAction(actionTextColor);
menu->addAction(ui.actionOrderedlist);
menu->addAction(ui.actionUnorderedlist);
menu->addAction(ui.actionBlockquoute);
/*comboStyle = new QComboBox(ui.toolBar_2);
ui.toolBar_2->addWidget(comboStyle);
comboStyle->addItem("Paragraph");
comboStyle->addItem("Heading 1");
comboStyle->addItem("Heading 2");
comboStyle->addItem("Heading 3");
comboStyle->addItem("Heading 4");
comboStyle->addItem("Heading 5");
comboStyle->addItem("Heading 6");
//.........这里部分代码省略.........