本文整理汇总了C++中QToolButton::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::setEnabled方法的具体用法?C++ QToolButton::setEnabled怎么用?C++ QToolButton::setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateButtons
void TabBarPrivate::updateButtons()
{
scrollFirstButton->setEnabled(tabbar->canScrollBack());
scrollBackButton->setEnabled(tabbar->canScrollBack());
scrollForwardButton->setEnabled(tabbar->canScrollForward());
scrollLastButton->setEnabled(tabbar->canScrollForward());
}
示例2: setContentsMargins
QgsFilterAlgorithmConfigurationWidget::QgsFilterAlgorithmConfigurationWidget( QWidget *parent )
: QgsProcessingAlgorithmConfigurationWidget( parent )
{
setContentsMargins( 0, 0, 0, 0 );
mOutputExpressionWidget = new QTableWidget();
mOutputExpressionWidget->setColumnCount( 3 );
mOutputExpressionWidget->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr( "Output Name" ) ) );
mOutputExpressionWidget->setHorizontalHeaderItem( 1, new QTableWidgetItem( tr( "Filter Expression" ) ) );
mOutputExpressionWidget->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "Final Output" ) ) );
mOutputExpressionWidget->horizontalHeader()->setResizeMode( 1, QHeaderView::Stretch );
QGridLayout *layout = new QGridLayout();
setLayout( layout );
layout->addWidget( new QLabel( tr( "Outputs and filters" ) ), 0, 0, 1, 2 );
layout->addWidget( mOutputExpressionWidget, 1, 0, 4, 1 );
QToolButton *addOutputButton = new QToolButton();
addOutputButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddLayer.svg" ) ) );
addOutputButton->setText( tr( "Add Output" ) );
QToolButton *removeOutputButton = new QToolButton();
removeOutputButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionRemoveLayer.svg" ) ) );
removeOutputButton->setToolTip( tr( "Remove Selected Outputs" ) );
layout->addWidget( addOutputButton, 2, 1, 1, 1 );
layout->addWidget( removeOutputButton, 3, 1, 1, 1 );
connect( addOutputButton, &QToolButton::clicked, this, &QgsFilterAlgorithmConfigurationWidget::addOutput );
connect( removeOutputButton, &QToolButton::clicked, this, &QgsFilterAlgorithmConfigurationWidget::removeSelectedOutputs );
connect( mOutputExpressionWidget->selectionModel(), &QItemSelectionModel::selectionChanged, this, [removeOutputButton, this]
{
removeOutputButton->setEnabled( !mOutputExpressionWidget->selectionModel()->selectedIndexes().isEmpty() );
} );
}
示例3: setElement
void InspectorBase::setElement(Element* e)
{
for (int i = 0; i < inspectorItems(); ++i) {
QWidget* w = item(i).w;
P_ID id = item(i).t;
P_TYPE pt = propertyType(id);
QVariant val;
if (pt == T_SIZE || pt == T_SCALE) {
QSizeF sz = e->getProperty(id).toSizeF();
if (item(i).sv == 0)
val = QVariant(sz.width());
else
val = QVariant(sz.height());
}
else if (pt == T_POINT) {
QPointF sz = e->getProperty(id).toPointF();
if (item(i).sv == 0)
val = QVariant(sz.x());
else
val = QVariant(sz.y());
}
else
val = e->getProperty(id);
w->blockSignals(true);
setValue(i, val);
w->blockSignals(false);
QToolButton* r = item(i).r;
if (r)
r->setEnabled(!isDefault(i));
}
}
示例4: initWidget
void MusicProgressWidget::initWidget()
{
m_background = new QLabel(this);
m_background->setGeometry(20, 20, 360, 115);
QWidget *backgroundMask = new QWidget(this);
backgroundMask->setGeometry(20, 45, 360, 90);
backgroundMask->setStyleSheet("background:rgba(255,255,255,200);");
QLabel *topTitleName = new QLabel(this);
topTitleName->setText(tr("Progress Bar"));
topTitleName->setGeometry(30, 20, 221, 25);
topTitleName->setStyleSheet("color:#FFFFFF;font-weight:bold;");
QToolButton *topTitleCloseButton = new QToolButton(this);
topTitleCloseButton->setGeometry(360, 22, 20, 20);
topTitleCloseButton->setIcon(QIcon(":/share/searchclosed"));
topTitleCloseButton->setStyleSheet(MusicUIObject::MToolButtonStyle03);
topTitleCloseButton->setEnabled(false);
m_progressBar = new QProgressBar(this);
setBar(m_progressBar);
m_progressBar->setStyleSheet(MusicUIObject::MProgressBar01);
m_textLabel = new QLabel(this);
m_textLabel->setAlignment(Qt::AlignCenter);
m_textLabel->setGeometry(40, 50, 320, 25);
}
示例5: add_toolbar_button
QToolButton* vktraceviewer::add_toolbar_button(const QString& title, bool bEnabled)
{
QToolButton* pButton = new QToolButton(ui->mainToolBar);
pButton->setText(title);
pButton->setEnabled(bEnabled);
ui->mainToolBar->addWidget(pButton);
return pButton;
}
示例6: SIGNAL
static QToolButton *createFilterButton(QIcon icon, const QString &toolTip,
QObject *receiver, const char *slot)
{
QToolButton *button = new QToolButton;
button->setIcon(icon);
button->setToolTip(toolTip);
button->setCheckable(true);
button->setChecked(true);
button->setAutoRaise(true);
button->setEnabled(true);
QObject::connect(button, SIGNAL(toggled(bool)), receiver, slot);
return button;
}
示例7: startPauseButtonClicked
void ManagerWindow::startPauseButtonClicked()
{
QToolButton* queueButton = qobject_cast<QToolButton*>(QObject::sender());
queueButton->setEnabled(false);
QString queue = this->queueButtons.value(queueButton);
AstCtiExtensionPtr extension =
this->config->extensions.at(this->ui->accountsTabWidget->currentIndex());
AstCtiAgentStatus status = extension->queues.value(queue);
if (status == AgentStatusLoggedIn)
emit this->pauseRequest(queue, extension->channelName);
else
emit this->startRequest(queue, extension->channelName);
}
示例8: listPlugins
void OptionsTabPlugins::listPlugins()
{
if ( !w )
return;
OptPluginsUI *d = (OptPluginsUI *)w;
d->tw_Plugins->clear();
PluginManager *pm=PluginManager::instance();
QStringList plugins = pm->availablePlugins();
plugins.sort();
const QSize buttonSize = QSize(21,21);
foreach ( const QString& plugin, plugins ){
QIcon icon = pm->icon(plugin);
bool enabled = pm->isEnabled(plugin);
const QString path = pm->pathToPlugin(plugin);
QString toolTip = tr("Plugin Path:\n%1").arg(path);
Qt::CheckState state = enabled ? Qt::Checked : Qt::Unchecked;
QTreeWidgetItem *item = new QTreeWidgetItem(d->tw_Plugins, QTreeWidgetItem::Type);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setText(C_NAME, plugin);
item->setText(C_VERSION, pm->version(plugin));
item->setTextAlignment(C_VERSION, Qt::AlignHCenter);
item->setToolTip(C_NAME, toolTip);
item->setCheckState(C_NAME, state);
if ( !enabled ) {
icon = QIcon(icon.pixmap(icon.availableSizes().at(0), QIcon::Disabled));
}
item->setIcon(C_NAME,icon);
QString shortName = PluginManager::instance()->shortName(plugin);
QToolButton *aboutbutton = new QToolButton(d->tw_Plugins);
aboutbutton->setIcon(QIcon(IconsetFactory::iconPixmap("psi/info")));
aboutbutton->resize(buttonSize);
aboutbutton->setObjectName("ab_" + shortName);
aboutbutton->setToolTip(tr("Show information about plugin"));
connect(aboutbutton, SIGNAL(clicked()), this, SLOT(showPluginInfo()));
d->tw_Plugins->setItemWidget(item, C_ABOUT, aboutbutton);
QToolButton *settsbutton = new QToolButton(d->tw_Plugins);
settsbutton->setIcon(QIcon(IconsetFactory::iconPixmap("psi/options")));
settsbutton->resize(buttonSize);
settsbutton->setObjectName("sb_" + shortName);
settsbutton->setToolTip(tr("Open plugin settings dialog"));
connect(settsbutton, SIGNAL(clicked()), this, SLOT(settingsClicked()));
settsbutton->setEnabled(enabled);
d->tw_Plugins->setItemWidget(item, C_SETTS, settsbutton);
}
示例9: getProgram
void
MidiProgramsEditor::slotKeyMapMenuItemSelected(int i)
{
if (!m_device)
return ;
const KeyMappingList &kml = m_device->getKeyMappings();
if (kml.empty())
return ;
MidiProgram *program = getProgram(*getCurrentBank(), m_currentMenuProgram);
if (!program)
return ;
std::string newMapping;
if (i == 0) { // no key mapping
newMapping = "";
} else {
--i;
if (i < (int)kml.size()) {
newMapping = kml[i].getName();
}
}
m_device->setKeyMappingForProgram(*program, newMapping);
// QString pixmapDir = KGlobal::dirs()->findResource("appdata", "pixmaps/");
IconLoader il;
QIcon icon;
bool haveKeyMappings = (m_device->getKeyMappings().size() > 0); //@@@ JAS restored from before port/
QToolButton *btn = getKeyMapButton(m_currentMenuProgram);
if (newMapping.empty()) {
icon = il.load( "key-white" );
if( ! icon.isNull() ) {
btn->setIcon( icon );
}
// QToolTip::remove(btn);
btn->setToolTip(QString("")); //@@@ Usefull ?
} else {
icon = il.load( "key-green" );
if( ! icon.isNull() ){
btn->setIcon( icon );
}
btn->setToolTip(tr("Key Mapping: %1").arg(strtoqstr(newMapping)));
}
btn->setEnabled(haveKeyMappings);
}
示例10: QTreeWidgetItem
QTreeWidgetItem * QtHelpConfig::addTableItem(const QString &icon, const QString &name,
const QString &path, const QString &ghnsStatus)
{
QTreeWidgetItem *item = new QTreeWidgetItem(m_configWidget->qchTable);
item->setIcon(NameColumn, QIcon::fromTheme(icon));
item->setText(NameColumn, name);
item->setToolTip(NameColumn, name);
item->setText(PathColumn, path);
item->setToolTip(PathColumn, path);
item->setText(IconColumn, icon);
item->setText(GhnsColumn, ghnsStatus);
QWidget *ctrlWidget = new QWidget(item->treeWidget());
ctrlWidget->setLayout(new QHBoxLayout(ctrlWidget));
QToolButton *modifyBtn = new QToolButton(item->treeWidget());
modifyBtn->setIcon(QIcon::fromTheme("document-edit"));
modifyBtn->setToolTip(i18n("Modify"));
connect(modifyBtn, &QPushButton::clicked, this, [=](){
modify(item);
});
QToolButton *removeBtn = new QToolButton(item->treeWidget());
removeBtn->setIcon(QIcon::fromTheme("entry-delete"));
removeBtn->setToolTip(i18n("Delete"));
if (item->text(GhnsColumn) != "0") {
// KNS3 currently does not provide API to uninstall entries
// just removing the files results in wrong installed states in the KNS3 dialog
// TODO: add API to KNS to remove files without UI interaction
removeBtn->setEnabled(false);
removeBtn->setToolTip(tr("Please uninstall this via GHNS"));
} else {
connect(removeBtn, &QPushButton::clicked, this, [=](){
remove(item);
});
}
ctrlWidget->layout()->addWidget(modifyBtn);
ctrlWidget->layout()->addWidget(removeBtn);
m_configWidget->qchTable->setItemWidget(item, ConfigColumn, ctrlWidget);
return item;
}
示例11: QWidget
QT_BEGIN_NAMESPACE
PropertyEditor::PropertyEditor(QWidget *widget, QModelingObject *modelingObject, QMetaProperty *metaProperty, QWidget *parent) :
QWidget(parent), _widget(widget), _modelingObject(modelingObject), _metaProperty(metaProperty)
{
QHBoxLayout *layout = new QHBoxLayout;
layout->setMargin(0);
layout->setSpacing(0);
layout->addWidget(_widget);
if (widget && _metaProperty->isResettable()) {
QToolButton *toolButton = new QToolButton;
toolButton->setIcon(QPixmap(QString::fromLatin1(":/icons/resetproperty.png")));
toolButton->setMaximumSize(22, 22);
toolButton->setEnabled(_modelingObject->isPropertyModified(*_metaProperty));
connect(toolButton, &QToolButton::clicked, this, &PropertyEditor::resetClicked);
layout->addWidget(toolButton);
}
setLayout(layout);
if (QComboBox *comboBox = qobject_cast<QComboBox *>(_widget))
connect(comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &PropertyEditor::currentIndexChanged);
if (QCheckBox *checkBox = qobject_cast<QCheckBox *>(_widget))
connect(checkBox, &QCheckBox::stateChanged, this, &PropertyEditor::currentIndexChanged);
}
示例12: QWidget
Kleo::DNAttributeOrderConfigWidget::DNAttributeOrderConfigWidget( DNAttributeMapper * mapper, QWidget * parent, Qt::WindowFlags f )
: QWidget( parent, f ), d( new Private )
{
assert( mapper );
d->mapper = mapper;
QGridLayout * glay = new QGridLayout( this );
glay->setMargin( 0 );
glay->setSpacing( KDialog::spacingHint() );
glay->setColumnStretch( 0, 1 );
glay->setColumnStretch( 2, 1 );
int row = -1;
++row;
glay->addWidget( new QLabel( i18n("Available attributes:"), this ), row, 0 );
glay->addWidget( new QLabel( i18n("Current attribute order:"), this ), row, 2 );
++row;
glay->setRowStretch( row, 1 );
d->availableLV = new Q3ListView( this );
prepare( d->availableLV );
d->availableLV->setSorting( 0 );
glay->addWidget( d->availableLV, row, 0 );
d->currentLV = new Q3ListView( this );
prepare( d->currentLV );
d->currentLV->setSorting( -1 );
glay->addWidget( d->currentLV, row, 2 );
connect( d->availableLV, SIGNAL(clicked(Q3ListViewItem*)),
SLOT(slotAvailableSelectionChanged(Q3ListViewItem*)) );
connect( d->currentLV, SIGNAL(clicked(Q3ListViewItem*)),
SLOT(slotCurrentOrderSelectionChanged(Q3ListViewItem*)) );
d->placeHolderItem = new Q3ListViewItem( d->availableLV, "_X_", i18n("All others") );
// the up/down/left/right arrow cross:
QGridLayout * xlay = new QGridLayout();
xlay->setSpacing( 0 );
xlay->setObjectName( "xlay" );
xlay->setAlignment( Qt::AlignCenter );
static const struct {
const char * icon;
int row, col;
const char * tooltip;
const char * slot;
} navButtons[] = {
{ "go-top", 0, 1, I18N_NOOP( "Move to top" ), SLOT(slotDoubleUpButtonClicked()) },
{ "go-up", 1, 1, I18N_NOOP( "Move one up" ), SLOT(slotUpButtonClicked()) },
{ "go-previous", 2, 0, I18N_NOOP( "Remove from current attribute order" ), SLOT(slotLeftButtonClicked()) },
{ "go-next", 2, 2, I18N_NOOP( "Add to current attribute order" ), SLOT(slotRightButtonClicked()) },
{ "go-down", 3, 1, I18N_NOOP( "Move one down" ), SLOT(slotDownButtonClicked()) },
{ "go-bottom", 4, 1, I18N_NOOP( "Move to bottom" ), SLOT(slotDoubleDownButtonClicked()) }
};
for ( unsigned int i = 0 ; i < sizeof navButtons / sizeof *navButtons ; ++i ) {
QToolButton * tb = d->navTB[i] = new QToolButton( this );
tb->setIcon( KIcon( navButtons[i].icon ) );
tb->setEnabled( false );
tb->setToolTip( i18n( navButtons[i].tooltip ) );
xlay->addWidget( tb, navButtons[i].row, navButtons[i].col );
connect( tb, SIGNAL(clicked()), navButtons[i].slot );
}
glay->addLayout( xlay, row, 1 );
}
示例13: helpback
HelpWindow::HelpWindow( const QString& home_, const QString& _path,
QWidget* parent, const char *name) :
Q3MainWindow( parent, name, Qt::WDestructiveClose ),
pathCombo( 0 ), selectedURL()
{
DigitDebug::ctor(QString("helpwindow " + QString::number((ulong) this, 16)));
readHistory();
readBookmarks();
browser = new Q3TextBrowser( this );
CHECK_PTR_ENGAUGE(browser);
browser->mimeSourceFactory()->setFilePath( _path );
browser->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken );
connect( browser, SIGNAL( textChanged() ),
this, SLOT( textChanged() ) );
setCentralWidget( browser );
if ( !home_.isEmpty() )
browser->setSource( home_ );
connect( browser, SIGNAL( highlighted( const QString&) ),
statusBar(), SLOT( message( const QString&)) );
// display help window in previous position with same size
DefaultSettings& rSettings = DefaultSettings::instance();
move(rSettings.getWindowHelpPosition());
resize(rSettings.getWindowHelpSize());
QMenu* file = new QMenu( this );
CHECK_PTR_ENGAUGE(file);
file->insertItem( tr("&Open File"), this, SLOT( openFile() ), Qt::CTRL+Qt::Key_O );
file->insertItem( tr("&Print"), this, SLOT( print() ), Qt::CTRL+Qt::Key_P );
file->insertSeparator();
file->insertItem( tr("&Close"), this, SLOT( close() ), Qt::CTRL+Qt::Key_Q );
//file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), Qt::CTRL+Qt::Key_X );
// The same three icons are used twice each.
QPixmap helpback (helpback_xpm);
QPixmap helpforward (helpforward_xpm);
QPixmap helphome (helphome_xpm);
QIcon icon_back (helpback);
QIcon icon_forward (helpforward);
QIcon icon_home (helphome);
QMenu* go = new QMenu( this );
CHECK_PTR_ENGAUGE(go);
backwardId = go->insertItem( icon_back,
tr("&Backward"), browser, SLOT( backward() ),
Qt::CTRL+Qt::Key_Left );
forwardId = go->insertItem( icon_forward,
tr("&Forward"), browser, SLOT( forward() ),
Qt::CTRL+Qt::Key_Right );
go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );
hist = new QMenu( this );
CHECK_PTR_ENGAUGE(hist);
QStringList::Iterator it = history.begin();
for ( ; it != history.end(); ++it )
mHistory[ hist->insertItem( *it ) ] = *it;
connect( hist, SIGNAL( activated( int ) ),
this, SLOT( histChosen( int ) ) );
bookm = new QMenu( this );
CHECK_PTR_ENGAUGE(bookm);
bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
bookm->insertSeparator();
QStringList::Iterator it2 = bookmarks.begin();
for ( ; it2 != bookmarks.end(); ++it2 )
mBookmarks[ bookm->insertItem( *it2 ) ] = *it2;
connect( bookm, SIGNAL( activated( int ) ),
this, SLOT( bookmChosen( int ) ) );
menuBar()->insertItem( tr("&File"), file );
menuBar()->insertItem( tr("&Go"), go );
menuBar()->insertItem( tr( "History" ), hist );
menuBar()->insertItem( tr( "Bookmarks" ), bookm );
menuBar()->setItemEnabled( forwardId, FALSE);
menuBar()->setItemEnabled( backwardId, FALSE);
connect( browser, SIGNAL( backwardAvailable( bool ) ),
this, SLOT( setBackwardAvailable( bool ) ) );
connect( browser, SIGNAL( forwardAvailable( bool ) ),
this, SLOT( setForwardAvailable( bool ) ) );
Q3ToolBar* toolbar = new Q3ToolBar( this );
CHECK_PTR_ENGAUGE(toolbar);
addToolBar( toolbar, "Toolbar");
QToolButton* button;
button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
CHECK_PTR_ENGAUGE(button);
connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
button->setEnabled( FALSE );
button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
CHECK_PTR_ENGAUGE(button);
//.........这里部分代码省略.........
示例14: RecreateButtons
//.........这里部分代码省略.........
// mmueller
button->setCheckable ( true );
if(currentToolID == m_ToolManager->GetActiveToolID())
button->setChecked(true);
QString label;
if (m_GenerateAccelerators)
{
label += "&";
}
label += tool->GetName();
QString tooltip = tool->GetName();
MITK_DEBUG << tool->GetName() << ", " << label.toLocal8Bit().constData() << ", '" << tooltip.toLocal8Bit().constData();
if ( m_ShowNames )
{
/*
button->setUsesTextLabel(true);
button->setTextLabel( label ); // a label
QToolTip::add( button, tooltip );
*/
// mmueller Qt
button->setText( label ); // a label
button->setToolTip( tooltip );
// mmueller
QFont currentFont = button->font();
currentFont.setBold(false);
button->setFont( currentFont );
}
us::ModuleResource iconResource = tool->GetIconResource();
if (!iconResource.IsValid())
{
button->setIcon(QIcon(QPixmap(tool->GetXPM())));
}
else
{
us::ModuleResourceStream resourceStream(iconResource, std::ios::binary);
resourceStream.seekg(0, std::ios::end);
std::ios::pos_type length = resourceStream.tellg();
resourceStream.seekg(0, std::ios::beg);
char* data = new char[length];
resourceStream.read(data, length);
QPixmap pixmap;
pixmap.loadFromData(QByteArray::fromRawData(data, length));
QIcon* icon = new QIcon(pixmap);
delete[] data;
button->setIcon(*icon);
if (m_ShowNames)
{
if (m_LayoutColumns == 1)
button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
else
button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
button->setIconSize(QSize(24, 24));
}
else
{
button->setToolButtonStyle(Qt::ToolButtonIconOnly);
button->setIconSize(QSize(32,32));
button->setToolTip(tooltip);
}
}
if (m_GenerateAccelerators)
{
QString firstLetter = QString( tool->GetName() );
firstLetter.truncate( 1 );
button->setShortcut( firstLetter ); // a keyboard shortcut (just the first letter of the given name w/o any CTRL or something)
}
mitk::DataNode* dataNode = m_ToolManager->GetReferenceData(0);
if (dataNode != NULL && !tool->CanHandle(dataNode->GetData()))
button->setEnabled(false);
m_ButtonIDForToolID[currentToolID] = currentButtonID;
m_ToolIDForButtonID[currentButtonID] = currentToolID;
MITK_DEBUG << "m_ButtonIDForToolID[" << currentToolID << "] == " << currentButtonID;
MITK_DEBUG << "m_ToolIDForButtonID[" << currentButtonID << "] == " << currentToolID;
tool->GUIProcessEventsMessage += mitk::MessageDelegate<QmitkToolSelectionBox>( this, &QmitkToolSelectionBox::OnToolGUIProcessEventsMessage ); // will never add a listener twice, so we don't have to check here
tool->ErrorMessage += mitk::MessageDelegate1<QmitkToolSelectionBox, std::string>( this, &QmitkToolSelectionBox::OnToolErrorMessage ); // will never add a listener twice, so we don't have to check here
tool->GeneralMessage += mitk::MessageDelegate1<QmitkToolSelectionBox, std::string>( this, &QmitkToolSelectionBox::OnGeneralToolMessage );
++currentButtonID;
}
// setting grid layout for this groupbox
this->setLayout(m_ButtonLayout);
//this->update();
}
示例15: icon_back
FLHelpWindow::FLHelpWindow(const QString &home_,
const QString &_path,
QWidget *parent,
const char *name) :
QMainWindow(parent, name, WDestructiveClose),
pathCombo(0), selectedURL()
{
readHistory();
readBookmarks();
browser = new QTextBrowser(this);
browser->mimeSourceFactory() ->setFilePath(_path);
browser->setFrameStyle(QFrame::Panel | QFrame::Sunken);
connect(browser, SIGNAL(textChanged()), this, SLOT(textChanged()));
setCentralWidget(browser);
if (!home_.isEmpty())
browser->setSource(home_);
connect(browser, SIGNAL(highlighted(const QString &)), statusBar(),
SLOT(message(const QString &)));
resize(640, 700);
QPopupMenu *file = new QPopupMenu(this);
file->insertItem(tr("&Imprimir"), this, SLOT(print()), CTRL + Key_I);
file->insertSeparator();
file->insertItem(tr("&Cerrar"), this, SLOT(close()), Key_Escape);
// The same three icons are used twice each.
QIconSet icon_back(QPixmap::fromMimeSource("previous.png"));
QIconSet icon_forward(QPixmap::fromMimeSource("next.png"));
QIconSet icon_home(QPixmap::fromMimeSource("home.png"));
QPopupMenu *go = new QPopupMenu(this);
backwardId =
go->insertItem(icon_back, tr("&Atrás"), browser, SLOT(backward()),
CTRL + Key_Left);
forwardId =
go->insertItem(icon_forward, tr("&Adelante"), browser,
SLOT(forward()), CTRL + Key_Right);
go->insertItem(icon_home, tr("&Inicio"), browser, SLOT(home()));
QPopupMenu *help = new QPopupMenu(this);
help->insertItem(tr("&Acerca ..."), this, SLOT(about()));
help->insertItem(tr("Acerca de &Qt ..."), this, SLOT(aboutQt()));
hist = new QPopupMenu(this);
QStringList::Iterator it = history.begin();
for (; it != history.end(); ++it)
mHistory[ hist->insertItem(*it)] = *it;
connect(hist, SIGNAL(activated(int)), this, SLOT(histChosen(int)));
bookm = new QPopupMenu(this);
bookm->insertItem(tr("Agregar Favorito"), this, SLOT(addBookmark()));
bookm->insertSeparator();
QStringList::Iterator it2 = bookmarks.begin();
for (; it2 != bookmarks.end(); ++it2)
mBookmarks[ bookm->insertItem(*it2)] = *it2;
connect(bookm, SIGNAL(activated(int)), this, SLOT(bookmChosen(int)));
menuBar() ->insertItem(tr("&Archivo"), file);
menuBar() ->insertItem(tr("&Ir"), go);
menuBar() ->insertItem(tr("Historial"), hist);
menuBar() ->insertItem(tr("Favoritos"), bookm);
menuBar() ->insertSeparator();
menuBar() ->insertItem(tr("&Ayuda"), help);
menuBar() ->setItemEnabled(forwardId, FALSE);
menuBar() ->setItemEnabled(backwardId, FALSE);
connect(browser, SIGNAL(backwardAvailable(bool)), this,
SLOT(setBackwardAvailable(bool)));
connect(browser, SIGNAL(forwardAvailable(bool)), this,
SLOT(setForwardAvailable(bool)));
QToolBar *toolbar = new QToolBar(this);
addToolBar(toolbar, "Toolbar");
QToolButton *button;
button =
new QToolButton(icon_back, tr("Atrás"), "", browser, SLOT(backward()),
toolbar);
connect(browser, SIGNAL(backwardAvailable(bool)), button,
SLOT(setEnabled(bool)));
button->setEnabled(FALSE);
button =
new QToolButton(icon_forward, tr("Adelante"), "", browser,
SLOT(forward()), toolbar);
connect(browser, SIGNAL(forwardAvailable(bool)), button,
SLOT(setEnabled(bool)));
button->setEnabled(FALSE);
button =
//.........这里部分代码省略.........