コード例 #1
0
ファイル: TabBar.cpp プロジェクト: UIKit0/calligra
void TabBarPrivate::updateButtons()
{
    scrollFirstButton->setEnabled(tabbar->canScrollBack());
    scrollBackButton->setEnabled(tabbar->canScrollBack());
    scrollForwardButton->setEnabled(tabbar->canScrollForward());
    scrollLastButton->setEnabled(tabbar->canScrollForward());
}
コード例 #2
0
void KMConfigFilter::slotSelectionChanged()
{
    const KListBox *lb = static_cast< const KListBox * >(sender());
    if(!lb)
        return;
    QToolButton *pb = (lb == m_list1 ? m_add : m_remove);
    for(uint i = 0; i < lb->count(); i++)
        if(lb->isSelected(i))
        {
            pb->setEnabled(true);
            return;
        }
    pb->setEnabled(false);
}
コード例 #3
0
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() );
  } );
}
コード例 #4
0
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));
            }
      }
コード例 #5
0
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);
}
コード例 #6
0
ファイル: vktraceviewer.cpp プロジェクト: ZLixing/VulkanTools
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;
}
コード例 #7
0
ファイル: taskwindow.cpp プロジェクト: AtlantisCD9/Qt
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;
}
コード例 #8
0
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);
}
コード例 #9
0
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);
	}
コード例 #10
0
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);
}
コード例 #11
0
ファイル: qthelpconfig.cpp プロジェクト: KDE/kdevelop
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;
}
コード例 #12
0
ファイル: propertyeditor.cpp プロジェクト: qt/qtmodeling
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);
}
コード例 #13
0
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 );
}
コード例 #14
0
ファイル: helpwindow.cpp プロジェクト: crayxt/digitizer
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);
  connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
  button->setEnabled( FALSE );
  button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );
  CHECK_PTR_ENGAUGE(button);

  toolbar->addSeparator();

  pathCombo = new QComboBox( TRUE, toolbar );
  CHECK_PTR_ENGAUGE(pathCombo);
  connect( pathCombo, SIGNAL( activated( const QString & ) ),
    this, SLOT( pathSelected( const QString & ) ) );
  toolbar->setStretchableWidget( pathCombo );
  setRightJustification( TRUE );
  setDockEnabled( Qt::DockLeft, FALSE );
  setDockEnabled( Qt::DockRight, FALSE );

  pathCombo->insertItem( home_ );
  browser->setFocus();
}
コード例 #15
0
void QmitkToolSelectionBox::RecreateButtons()
{
  if (m_ToolManager.IsNull()) return;

  /*
  // remove all buttons that are there
  QObjectList *l = Q3ButtonGroup::queryList( "QButton" );
  QObjectListIt it( *l ); // iterate over all buttons
  QObject *obj;

  while ( (obj = it.current()) != 0 )
  {
    ++it;
    QButton* button = dynamic_cast<QButton*>(obj);
    if (button)
    {
      Q3ButtonGroup::remove(button);
      delete button;
    }
  }
  delete l; // delete the list, not the objects
  */

  // mmueller Qt impl
  QList<QAbstractButton *> l = m_ToolButtonGroup->buttons();
  // remove all buttons that are there
  QList<QAbstractButton *>::iterator it;
  QAbstractButton * btn;

  for(it=l.begin(); it!=l.end();++it)
  {
    btn = *it;
    m_ToolButtonGroup->removeButton(btn);
    //this->removeChild(btn);
    delete btn;
  }
  // end mmueller Qt impl

  mitk::ToolManager::ToolVectorTypeConst allPossibleTools = m_ToolManager->GetTools();
  mitk::ToolManager::ToolVectorTypeConst allTools;

  typedef std::pair< std::string::size_type, const mitk::Tool* > SortPairType;
  typedef std::priority_queue< SortPairType > SortedToolQueueType;
  SortedToolQueueType toolPositions;

  // clear and sort all tools
  // step one: find name/group of all tools in m_DisplayedGroups string. remember these positions for all tools.
  for ( mitk::ToolManager::ToolVectorTypeConst::const_iterator iter = allPossibleTools.begin();
        iter != allPossibleTools.end();
        ++iter)
  {
    const mitk::Tool* tool = *iter;

    std::string::size_type namePos =  m_DisplayedGroups.find( std::string("'") + tool->GetName() + "'" );
    std::string::size_type groupPos = m_DisplayedGroups.find( std::string("'") + tool->GetGroup() + "'" );

    if ( !m_DisplayedGroups.empty() && namePos == std::string::npos && groupPos == std::string::npos ) continue; // skip

    if ( m_DisplayedGroups.empty() && std::string(tool->GetName()).length() > 0 )
    {
      namePos = static_cast<std::string::size_type> (tool->GetName()[0]);
    }

    SortPairType thisPair = std::make_pair( namePos < groupPos ? namePos : groupPos, *iter );
    toolPositions.push( thisPair );
  }

  // step two: sort tools according to previously found positions in m_DisplayedGroups
  MITK_DEBUG << "Sorting order of tools (lower number --> earlier in button group)";
  while ( !toolPositions.empty() )
  {
    SortPairType thisPair = toolPositions.top();
    MITK_DEBUG << "Position " << thisPair.first << " : " << thisPair.second->GetName();

    allTools.push_back( thisPair.second );
    toolPositions.pop();
  }
  std::reverse( allTools.begin(), allTools.end() );

  MITK_DEBUG << "Sorted tools:";
  for ( mitk::ToolManager::ToolVectorTypeConst::const_iterator iter = allTools.begin();
        iter != allTools.end();
        ++iter)
  {
    MITK_DEBUG << (*iter)->GetName();
  }

  // try to change layout... bad?
  //Q3GroupBox::setColumnLayout ( m_LayoutColumns, Qt::Horizontal );
  // mmueller using gridlayout instead of Q3GroupBox
  //this->setLayout(0);
  if(m_ButtonLayout == NULL)
    m_ButtonLayout = new QGridLayout;
  /*else
    delete m_ButtonLayout;*/

  int row(0);
  int column(-1);

  int currentButtonID(0);
  m_ButtonIDForToolID.clear();
  m_ToolIDForButtonID.clear();
  QToolButton* button = 0;

  MITK_DEBUG << "Creating buttons for tools";
  // fill group box with buttons
  for ( mitk::ToolManager::ToolVectorTypeConst::const_iterator iter = allTools.begin();
        iter != allTools.end();
        ++iter)
  {
    const mitk::Tool* tool = *iter;
    int currentToolID( m_ToolManager->GetToolID( tool ) );

    ++column;
    // new line if we are at the maximum columns
    if(column == m_LayoutColumns)
    {
      ++row;
      column = 0;
    }

    button = new QToolButton;
    button->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
    // add new button to the group
    MITK_DEBUG << "Adding button with ID " << currentToolID;
    m_ToolButtonGroup->addButton(button, currentButtonID);
    // ... and to the layout
    MITK_DEBUG << "Adding button in row/column " << row << "/" << column;
    m_ButtonLayout->addWidget(button, row, column);

    if (m_LayoutColumns == 1)
    {
      //button->setTextPosition( QToolButton::BesideIcon );
      // mmueller
      button->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
    }
    else
    {
      //button->setTextPosition( QToolButton::BelowIcon );
      // mmueller
      button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
    }

    //button->setToggleButton( true );
    // 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();
}
コード例 #16
0
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 =
    new QToolButton(icon_home, tr("Inicio"), "", browser, SLOT(home()),
                    toolbar);

  toolbar->addSeparator();

  pathCombo = new QComboBox(TRUE, toolbar);
  connect(pathCombo, SIGNAL(activated(const QString &)), this,
          SLOT(pathSelected(const QString &)));
  toolbar->setStretchableWidget(pathCombo);
  setRightJustification(TRUE);
  setDockEnabled(DockLeft, FALSE);
  setDockEnabled(DockRight, FALSE);

  pathCombo->insertItem(home_);
  browser->setFocus();
}
コード例 #17
0
CentralWidget::CentralWidget(MainWindow *parent)
    : QWidget(parent)
    , lastTabPage(0)
    , tabWidget(0)
    , findWidget(0)
    , printer(0)
    , usesDefaultCollection(parent->usesDefaultCollection())
    , m_searchWidget(0)
{
    TRACE_OBJ
    globalActionList.clear();
    staticCentralWidget = this;
    QVBoxLayout *vboxLayout = new QVBoxLayout(this);
    QString resourcePath = QLatin1String(":/trolltech/assistant/images/");

    vboxLayout->setMargin(0);
    tabWidget = new QTabWidget(this);
#ifndef Q_OS_MAC
    resourcePath.append(QLatin1String("win"));
#else
    resourcePath.append(QLatin1String("mac"));
    tabWidget->setDocumentMode(true);
#endif

    connect(tabWidget, SIGNAL(currentChanged(int)), this,
        SLOT(currentPageChanged(int)));

    QToolButton *newTabButton = new QToolButton(this);
    newTabButton->setAutoRaise(true);
    newTabButton->setToolTip(tr("Add new page"));
    newTabButton->setIcon(QIcon(resourcePath + QLatin1String("/addtab.png")));

    tabWidget->setCornerWidget(newTabButton, Qt::TopLeftCorner);
    connect(newTabButton, SIGNAL(clicked()), this, SLOT(newTab()));

    QToolButton *closeTabButton = new QToolButton(this);
    closeTabButton->setEnabled(false);
    closeTabButton->setAutoRaise(true);
    closeTabButton->setToolTip(tr("Close current page"));
    closeTabButton->setIcon(QIcon(resourcePath + QLatin1String("/closetab.png")));

    tabWidget->setCornerWidget(closeTabButton, Qt::TopRightCorner);
    connect(closeTabButton, SIGNAL(clicked()), this, SLOT(closeTab()));

    vboxLayout->addWidget(tabWidget);

    findWidget = new FindWidget(this);
    vboxLayout->addWidget(findWidget);
    findWidget->hide();

    connect(findWidget, SIGNAL(findNext()), this, SLOT(findNext()));
    connect(findWidget, SIGNAL(findPrevious()), this, SLOT(findPrevious()));
    connect(findWidget, SIGNAL(find(QString, bool)), this,
        SLOT(find(QString, bool)));
    connect(findWidget, SIGNAL(escapePressed()), this, SLOT(activateTab()));

    QTabBar *tabBar = qFindChild<QTabBar*>(tabWidget);
    if (tabBar) {
        tabBar->installEventFilter(this);
        tabBar->setContextMenuPolicy(Qt::CustomContextMenu);
        connect(tabBar, SIGNAL(customContextMenuRequested(QPoint)), this,
            SLOT(showTabBarContextMenu(QPoint)));
    }

#if defined(QT_NO_WEBKIT)
    QPalette p = palette();
    p.setColor(QPalette::Inactive, QPalette::Highlight,
        p.color(QPalette::Active, QPalette::Highlight));
    p.setColor(QPalette::Inactive, QPalette::HighlightedText,
        p.color(QPalette::Active, QPalette::HighlightedText));
    setPalette(p);
#endif
}
コード例 #18
0
QHBoxLayout* QMathMLFileViewer::setupToolLayout()
{
	QHBoxLayout *toolLayout = new QHBoxLayout();

	QToolButton *btnRefresh = new QToolButton();
	btnRefresh->setIcon(QIcon(":/images/reload.png"));
	//btnRefresh->setIconSize(m_iconSize);
	btnRefresh->setToolTip(tr("Refresh contents of the current directory"));
	connect(btnRefresh, SIGNAL(clicked()), this, SLOT(fileRefresh()));
	toolLayout->addWidget( btnRefresh );

	QToolButton *btnView = new QToolButton();
	btnView->setIcon(QIcon(":/images/printpreview.png"));
	//btnView->setIconSize(m_iconSize);
	btnView->setToolTip(tr("Open the selected file as a new read-only window in the editor - for viewing purposes only"));
	connect(btnView, SIGNAL(clicked()), this, SLOT(fileLoad()));
	connect(this, SIGNAL(hasSelectedItem(bool)), btnView, SLOT(setEnabled(bool)));
	btnView->setEnabled( false );
	toolLayout->addWidget( btnView );

	QToolButton *btnOpen = new QToolButton();
	btnOpen->setIcon(QIcon(":/images/open.png"));
	//btnOpen->setIconSize(m_iconSize);
	btnOpen->setToolTip(tr("Open the selected file as a new window in the editor"));
	connect(btnOpen, SIGNAL(clicked()), this, SLOT(fileOpen()));
	connect(this, SIGNAL(hasSelectedItem(bool)), btnOpen, SLOT(setEnabled(bool)));
	btnOpen->setEnabled( false );
	toolLayout->addWidget( btnOpen );

	toolLayout->addSpacing( 12 );

	QLabel *labelMask = new QLabel(tr("Mask:"));
    fileComboBox = createComboBox(tr(DEFAULT_MASK));
	fileComboBox->setMinimumWidth( 80 );
	//fileComboBox->setIconSize(m_iconSize);
	toolLayout->addWidget( labelMask );
	toolLayout->addWidget( fileComboBox );

	QToolButton *btnFind = new QToolButton();
	btnFind->setIcon(QIcon(":/images/find.png"));
	//btnFind->setIconSize(m_iconSize);
	btnFind->setToolTip(tr("Find all files with a given name starting from the current directory"));
	connect(btnFind, SIGNAL(clicked()), this, SLOT(fileFind()));
	toolLayout->addWidget( btnFind );

	btnRecursive = new QToolButton();
	btnRecursive->setObjectName("__qt__fmlide_widget_QMathMLFileViewer_button_Recursive");
	btnRecursive->setIcon(QIcon(":/images/contents.png"));
	btnRecursive->setToolTip(tr("Set on/off recursive search from the current folder"));
	btnRecursive->setToolButtonStyle( Qt::ToolButtonIconOnly );
	btnRecursive->setCheckable( true );
	btnRecursive->setChecked( isRecursive() );
	connect(btnRecursive, SIGNAL(toggled(bool)), this, SLOT(setRecursive(bool)));
	toolLayout->addWidget( btnRecursive );

	QToolButton *btnBack = new QToolButton();
	btnBack->setIcon(QIcon(":/images/back.png"));
	//btnBack->setIconSize(m_iconSize);
	btnBack->setToolTip(tr("Select the previous found file"));
	connect(btnBack, SIGNAL(clicked()), this, SLOT(fileBack()));
	connect(this, SIGNAL(hasFound(bool)), btnBack, SLOT(setEnabled(bool)));
	btnBack->setEnabled( false );
	toolLayout->addWidget( btnBack );

	QToolButton *btnForward = new QToolButton();
	btnForward->setIcon(QIcon(":/images/forward.png"));
	//btnForward->setIconSize(m_iconSize);
	btnForward->setToolTip(tr("Select the next found file"));
	connect(btnForward, SIGNAL(clicked()), this, SLOT(fileForward()));
	connect(this, SIGNAL(hasFound(bool)), btnForward, SLOT(setEnabled(bool)));
	btnForward->setEnabled( false );
	toolLayout->addWidget( btnForward );

	toolLayout->addStretch( 1 );

	return toolLayout;
}
コード例 #19
0
ファイル: editortools.cpp プロジェクト: FXIhub/hawk
EditorTools::EditorTools(EditorWorkspace * parent)
  :QGroupBox((QWidget *)parent)
{
  editor = parent;
  setTitle(tr("Tools"));
  QGridLayout * layout = new QGridLayout(this);
  this->setLayout(layout);
  QSize iconSize = QSize(22,22);
  QToolButton * pointer = new QToolButton(this);
  pointer->setIcon(QIcon(":images/cursor_arrow.png"));
  pointer->setToolTip(tr("Drag/Scale Image\n(Shift to activate)"));
  pointer->setIconSize(iconSize);
  pointer->setCheckable(true);
  pointer->setAutoExclusive(true);
  if(editor->editorView()->editorMode() == ImageEditorView::EditorDefaultMode){
    pointer->setChecked(true);
  }
  connect(pointer,SIGNAL(clicked(bool)),this,SLOT(onPointerClicked()));
  layout->addWidget(pointer,0,0);
  QToolButton * bullseye = new QToolButton(this);
  bullseye->setIcon(QIcon(":images/bullseye.png"));
  bullseye->setToolTip(tr("Set Image Center"));
  bullseye->setIconSize(iconSize);
  bullseye->setCheckable(true);
  bullseye->setAutoExclusive(true);
  connect(bullseye,SIGNAL(toggled(bool)),this,SLOT(onBullseyeToggled(bool)));
  layout->addWidget(bullseye,0,1);
  QToolButton * drop = new QToolButton(this);
  drop->setIcon(QIcon(":images/water_drop.png"));
  drop->setToolTip(tr("Blur Image"));
  drop->setIconSize(iconSize);
  drop->setCheckable(true);
  drop->setAutoExclusive(true);
  if(editor->editorView()->editorMode() == ImageEditorView::EditorBlurMode){
    drop->setChecked(true);
  }
  connect(drop,SIGNAL(clicked(bool)),this,SLOT(onDropClicked()));
  layout->addWidget(drop,0,2);
  QToolButton * mathEdit = new QToolButton(this);
  mathEdit->setIcon(QIcon(":images/formula_pi.png"));
  mathEdit->setToolTip(tr("Evaluate Expression"));
  mathEdit->setIconSize(iconSize);
  connect(mathEdit,SIGNAL(clicked(bool)),this,SLOT(onMathEdit()));
  layout->addWidget(mathEdit,0,3);


  QToolButton * editMask = new QToolButton(this);
  editMask->setIcon(QIcon(":images/mask_happy.png"));
  editMask->setToolTip(tr("Edit image mask"));
  editMask->setIconSize(iconSize);
  editMask->setCheckable(true);
  editMask->setAutoExclusive(true);
  connect(editMask,SIGNAL(clicked(bool)),this,SLOT(onEditMaskClicked()));
  layout->addWidget(editMask,0,4);

  /*  QToolButton * filter = new QToolButton(this);
  filter->setIcon(QIcon(":images/optical_filter.png"));
  filter->setToolTip(tr("Filter Image"));
  filter->setIconSize(iconSize);
  filter->setCheckable(true);
  filter->setAutoExclusive(true);
  connect(filter,SIGNAL(clicked(bool)),this,SLOT(onFilterClicked()));
  layout->addWidget(filter,0,4);*/

  QToolButton * selection = new QToolButton(this);
  selection->setIcon(QIcon(":images/selection.png"));
  selection->setToolTip(tr("Select image section"));
  selection->setIconSize(iconSize);
  selection->setCheckable(true);
  selection->setAutoExclusive(true);
  connect(selection,SIGNAL(clicked(bool)),this,SLOT(onSelectionClicked()));
  layout->addWidget(selection,0,5);

  QToolButton * lineout = new QToolButton(this);
  lineout->setIcon(QIcon(":images/lineout_plot.png"));
  lineout->setToolTip(tr("Plot linear profile"));
  lineout->setIconSize(iconSize);
  lineout->setCheckable(true);
  lineout->setAutoExclusive(true);
  connect(lineout,SIGNAL(clicked(bool)),this,SLOT(onLineoutClicked()));
  layout->addWidget(lineout,0,6);

  QToolButton * undo = new QToolButton(this);
  undo->setIcon(QIcon(":images/undo.png"));
  undo->setToolTip(tr("Undo last edit"));
  undo->setIconSize(iconSize);
  undo->setEnabled(false);
  connect(undo,SIGNAL(clicked(bool)),this,SLOT(onUndoClicked()));
  layout->addWidget(undo,1,0);

  QToolButton * redo = new QToolButton(this);
  redo->setIcon(QIcon(":images/redo.png"));
  redo->setToolTip(tr("Redo last undone edit"));
  redo->setIconSize(iconSize);
  redo->setEnabled(false);
  connect(redo,SIGNAL(clicked(bool)),this,SLOT(onRedoClicked()));
  layout->addWidget(redo,1,1);

  QToolButton * removeElectronics = new QToolButton(this);
  removeElectronics->setIcon(QIcon(":images/hardware.png"));
  removeElectronics->setToolTip(tr("Remove electronic noise"));
  removeElectronics->setIconSize(iconSize);
  removeElectronics->setCheckable(true);
  removeElectronics->setAutoExclusive(true);
  connect(removeElectronics,SIGNAL(clicked(bool)),this,SLOT(onRemoveElectronicsClicked()));
  layout->addWidget(removeElectronics,1,2);

  QToolButton * xcamMagic = new QToolButton(this);
  xcamMagic->setIcon(QIcon(":images/xcam.png"));
  xcamMagic->setToolTip(tr("Remove overscan and noise from xcam data"));
  xcamMagic->setIconSize(iconSize);
  connect(xcamMagic,SIGNAL(clicked(bool)),this,SLOT(onXcamMagicClicked()));
  layout->addWidget(xcamMagic,1,3);

  QToolButton * fillEmpty = new QToolButton(this);
  fillEmpty->setIcon(QIcon(":images/magic.png"));
  fillEmpty->setToolTip(tr("Fill data on the missing regions by interpolation"));
  fillEmpty->setIconSize(iconSize);
  fillEmpty->setCheckable(true);
  fillEmpty->setAutoExclusive(true);
  connect(fillEmpty,SIGNAL(clicked(bool)),this,SLOT(onFillEmptyClicked()));
  layout->addWidget(fillEmpty,1,4);

  QToolButton * crop = new QToolButton(this);
  crop->setIcon(QIcon(":images/crop.png"));
  crop->setToolTip(tr("Crop image to selection"));
  crop->setIconSize(iconSize);
  connect(crop,SIGNAL(clicked(bool)),this,SLOT(onCropClicked()));
  layout->addWidget(crop,1,5);

  //  connect(mathEdit,SIGNAL(clicked(bool)),this,SLOT(onMathEdit()));
  
  toolOptions = new QWidget(this);
  QVBoxLayout * vbox = new QVBoxLayout(toolOptions);
  toolOptions->setLayout(vbox);
  QFrame * separator = new QFrame(toolOptions);
  separator->setFrameStyle(QFrame::HLine|QFrame::Raised);
  separator->setLineWidth(1);


  vbox->addWidget(separator);
  toolOptionsLayout = new QStackedLayout();
  vbox->addLayout(toolOptionsLayout);
  toolOptionsLayout->addWidget(new QWidget(toolOptions));
  toolOptionsLayout->addWidget(new QWidget(toolOptions));

  dropToolOptions = new QWidget(toolOptions);
  QGridLayout * grid = new QGridLayout(dropToolOptions);
  dropToolOptions->setLayout(grid);
  grid->addWidget(new QLabel(tr("Brush Radius:"),dropToolOptions),0,0);
  QDoubleSpinBox * spinBox = new QDoubleSpinBox(dropToolOptions);
  connect(spinBox,SIGNAL(valueChanged(double)),editor->editorView(),SLOT(setDropBrushRadius(double)));
  spinBox->setMinimum(0);
  spinBox->setValue(editor->editorView()->getDropBrushRadius());
  grid->addWidget(spinBox,0,1);
  grid->addWidget(new QLabel(tr("Blur Radius:"),dropToolOptions),1,0);
  spinBox = new QDoubleSpinBox(dropToolOptions);
  spinBox->setMinimum(0);
  spinBox->setValue(editor->editorView()->getDropBlurRadius());
  connect(spinBox,SIGNAL(valueChanged(double)),editor->editorView(),SLOT(setDropBlurRadius(double)));
  grid->addWidget(spinBox,1,1);
  toolOptionsLayout->addWidget(dropToolOptions);

  
  editMaskToolOptions = new QWidget(toolOptions);
  grid = new QGridLayout(editMaskToolOptions);
  editMaskToolOptions->setLayout(grid);
  QLabel * label = new QLabel(tr("Mode:"),editMaskToolOptions);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  grid->addWidget(label,1,1);
  editMaskIncludeButton = new QToolButton(editMaskToolOptions);
  editMaskIncludeButton->setIcon(QIcon(":images/mask_happy.png"));
  editMaskIncludeButton->setToolTip("Include in mask");
  editMaskIncludeButton->setCheckable(true);
  editMaskIncludeButton->setChecked(true);
  editMaskIncludeButton->setAutoExclusive(true);
  grid->addWidget(editMaskIncludeButton,1,2);
  editMaskExcludeButton = new QToolButton(editMaskToolOptions);
  editMaskExcludeButton->setIcon(QIcon(":images/mask_sad.png"));
  editMaskExcludeButton->setToolTip("Exclude from mask");
  editMaskExcludeButton->setCheckable(true);
  editMaskExcludeButton->setAutoExclusive(true);
  grid->addWidget(editMaskExcludeButton,1,3);
  label = new QLabel(tr("Brush Radius:"),editMaskToolOptions);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  grid->addWidget(label,2,1);

  m_editMaskBrushRadius =  new QSpinBox(editMaskToolOptions);
  connect(m_editMaskBrushRadius,SIGNAL(valueChanged(int)),editor->editorView(),SLOT(updateEditMaskCursor(int)));
  m_editMaskBrushRadius->setValue(5);
  
  grid->addWidget(m_editMaskBrushRadius,2,2,1,2);

  QPushButton * loadMaskFromFile = new QPushButton("Load mask from file",
						   editMaskToolOptions);
  loadMaskFromFile->setToolTip("Load a mask from a black and white png file.\n"
			       "White is included in the mask and black excluded.");
  connect(loadMaskFromFile,SIGNAL(clicked()),this,SLOT(onLoadMaskFromFile()));
  grid->addWidget(loadMaskFromFile,3,1,1,3);

  QPushButton * invertMask = new QPushButton("Invert mask",
					     editMaskToolOptions);
  invertMask->setToolTip("Inverts the mask of the current image.");
  connect(invertMask,SIGNAL(clicked()),this,SLOT(onInvertMask()));
  grid->addWidget(invertMask,4,1,1,3);

  grid->setRowStretch(0,100);
  grid->setColumnStretch(0,100);
  grid->setRowStretch(5,100);
  grid->setColumnStretch(5,100);
  toolOptionsLayout->addWidget(editMaskToolOptions);

  filterToolOptions = new QWidget(toolOptions);
  grid = new QGridLayout(filterToolOptions);
  filterToolOptions->setLayout(grid);
  grid->addWidget(new QLabel(tr("Filter Type:"),filterToolOptions),0,0);
  QComboBox * comboBox = new QComboBox(filterToolOptions);
  comboBox->addItem("Gaussian Radial");
  comboBox->addItem("Horizontal bands removal");
  comboBox->setMinimumContentsLength(10);
  comboBox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
  grid->addWidget(comboBox,0,1);
  grid->setRowStretch(2,100);
  grid->setColumnStretch(2,100);
  toolOptionsLayout->addWidget(filterToolOptions);

  selectionToolOptions = new QWidget(toolOptions);
  grid = new QGridLayout(selectionToolOptions);
  selectionToolOptions->setLayout(grid);
  label = new QLabel("Mode:",selectionToolOptions);
  label->setAlignment(Qt::AlignRight);
  grid->addWidget(label,0,0);
  QToolButton *  button = new QToolButton(selectionToolOptions);
  button->setIcon(QIcon(":images/selection.png"));
  button->setToolTip("Set selection");
  button->setCheckable(true);
  button->setChecked(true);
  button->setAutoExclusive(true);
  connect(button,SIGNAL(clicked()),this,SLOT(setSelectionModeSet()));
  grid->addWidget(button,0,1);
  button = new QToolButton(selectionToolOptions);
  button->setIcon(QIcon(":images/selection_union.png"));
  button->setToolTip("Add to selection");
  button->setCheckable(true);
  button->setAutoExclusive(true);
  connect(button,SIGNAL(clicked()),this,SLOT(setSelectionModeUnite()));
  grid->addWidget(button,0,2);
  button = new QToolButton(selectionToolOptions);
  button->setIcon(QIcon(":images/selection_subtract.png"));
  button->setToolTip("Remove from selection");  
  button->setCheckable(true);
  button->setAutoExclusive(true);
  connect(button,SIGNAL(clicked()),this,SLOT(setSelectionModeSubtract()));
  grid->addWidget(button,0,3);
  label = new QLabel("Expression:",selectionToolOptions);
  label->setAlignment(Qt::AlignRight);
  grid->addWidget(label,1,0);
  selectExpression = new QLineEdit("A > 10",selectionToolOptions);
  grid->addWidget(selectExpression,1,1,1,3);
  QPushButton * evalExpression = new QPushButton("Select by Expression",selectionToolOptions);
  connect(evalExpression,SIGNAL(clicked()),this,SLOT(onSelectByExpression()));
  grid->addWidget(evalExpression,2,0,1,4);
  grid->setRowStretch(5,100);
  grid->setColumnStretch(5,100);
  _selectionMode = SelectionSet;
  toolOptionsLayout->addWidget(selectionToolOptions);

  electronicsToolOptions = new QWidget(toolOptions);
  grid = new QGridLayout(electronicsToolOptions);
  electronicsToolOptions->setLayout(grid);
  QPushButton * push = new QPushButton("Remove Vertical Lines",electronicsToolOptions);
  grid->addWidget(push,0,0);
  connect(push,SIGNAL(clicked()),this,SLOT(onRemoveVerticalLinesClicked()));
  push = new QPushButton("Remove Horizontal Lines",electronicsToolOptions);
  grid->addWidget(push,1,0);
  connect(push,SIGNAL(clicked()),this,SLOT(onRemoveHorizontalLinesClicked()));
  toolOptionsLayout->addWidget(electronicsToolOptions);

  fillEmptyToolOptions = new QWidget(toolOptions);
  grid = new QGridLayout(fillEmptyToolOptions);
  fillEmptyToolOptions->setLayout(grid);
  grid->addWidget(new QLabel("Blur Radius (px)",0,0));
  fillBlurRadius =  new QDoubleSpinBox(fillEmptyToolOptions);
  grid->addWidget(fillBlurRadius,0,1);

  grid->addWidget(new QLabel("Iterations"),1,0);
  fillIterations =  new QSpinBox(fillEmptyToolOptions);
  fillIterations->setMinimum(1);
  grid->addWidget(fillIterations,1,1);

  grid->addWidget(new QLabel("Blur Kernel"),2,0);
  fillBlurKernel = new QComboBox(fillEmptyToolOptions);
  fillBlurKernel->addItem("Gaussian");
  fillBlurKernel->addItem("Sinc");
  grid->addWidget(fillBlurKernel,2,1);

  push = new QPushButton("Interpolate",fillEmptyToolOptions);
  grid->addWidget(push,3,0,1,2);
  connect(push,SIGNAL(clicked()),this,SLOT(onInterpolateEmptyClicked()));
  toolOptionsLayout->addWidget(fillEmptyToolOptions);



  toolOptions->hide();
  layout->addWidget(toolOptions,2,0,1,11);
  layout->setColumnStretch(11,100);
  layout->setRowStretch(3,100);
}
コード例 #20
0
ファイル: help_window.cpp プロジェクト: cwarden/quasar
HelpWindow::HelpWindow(const QString& home, const QString& path,
		       QWidget* parent, const char* name)
    : QMainWindow(parent, name, WDestructiveClose)
{
    setCaption(tr("Quasar Help"));

    _browser = new QTextBrowser(this);
    _browser->mimeSourceFactory()->setFilePath(path);
    _browser->setFrameStyle(QFrame::Panel | QFrame::Sunken);

    setCentralWidget(_browser);

    if (!home.isEmpty())
	_browser->setSource(home);

    connect(_browser, SIGNAL(highlighted(const QString&)),
	    statusBar(), SLOT(message(const QString&)));

    resize(800, 700);

    QPopupMenu* file = new QPopupMenu(this);
    file->insertItem(tr("&Print"), this, SLOT(print()), ALT | Key_P);
    file->insertSeparator();
    file->insertItem(tr("&Close"), this, SLOT(close()), ALT | Key_Q );

    QPopupMenu* go = new QPopupMenu(this);
    _backwardId = go->insertItem(QPixmap(back_image),
				 tr("&Backward"), _browser, SLOT(backward()),
				 ALT | Key_Left);
    _forwardId = go->insertItem(QPixmap(forward_image),
				tr("&Forward"), _browser, SLOT(forward()),
				ALT | Key_Right);
    _homeId = go->insertItem(QPixmap(home_image),
			     tr("&Home"), _browser, SLOT(home()));

    menuBar()->insertItem(tr("&File"), file);
    menuBar()->insertItem(tr("&Go"), go);

    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);

    QToolButton* button;
    button = new QToolButton(QPixmap(back_image), tr("Backward"), "",
			     _browser, SLOT(backward()), toolbar);
    connect(_browser, SIGNAL(backwardAvailable(bool)), button,
	    SLOT(setEnabled(bool)));
    button->setEnabled(FALSE);

    button = new QToolButton(QPixmap(forward_image), tr("Forward"), "",
			     _browser, SLOT(forward()), toolbar);
    connect(_browser, SIGNAL(forwardAvailable(bool)), button,
	    SLOT(setEnabled(bool)));
    button->setEnabled(FALSE);

    button = new QToolButton(QPixmap(home_image), tr("Home"), "",
			     _browser, SLOT(home()), toolbar);
    toolbar->addSeparator();

    _browser->setFocus();
}
コード例 #21
0
ファイル: trabajadores.cpp プロジェクト: JustDevZero/bulmages
void Trabajadores::trabajadorClicked()
{
    BtCompany *emp1 = ( BtCompany * ) mainCompany();
    BtTicket *ticket = NULL;
    BtTicket *ticketv = NULL;
    bool encontrado = false;

    /// Buscamos cual ha sido el trabajador pulsado.
    BlDbRecordSet *cur = mainCompany() ->loadQuery ( "SELECT * FROM trabajador" );
    while ( !encontrado && !cur->eof() ) {
        if ( ( ( QPushButton * ) sender() ) ->text() == cur->value( "nomtrabajador" ) + " " + cur->value( "apellidostrabajador" )  
	&& ((cur->value("passwordtrabajador") == mui_password->text() || cur->value("passwordtrabajador") == "")) ) {
            encontrado = true;

        } else {
            cur->nextRecord();
        } // end if
    } // end while

    if (encontrado) {
      /// Buscamos el ticket vacio de este trabajador y lo pintamos
      for ( int i = 0; i < emp1->listaTickets() ->size(); ++i ) {
	  ticket = emp1->listaTickets() ->at ( i );

	  if ( ticket->nomTicketDefecto() == ticket->dbValue ( "nomticket" ) && cur->value( "idtrabajador" ) == ticket->dbValue ( "idtrabajador" ) ) {
	      ( ( BtCompany * ) mainCompany() ) ->setTicketActual ( ticket );
	      ticket->pintar();
	      ticketv = ticket;
	  }// end if
      }// end for

      /// Si el trabajador no tiene ticket vacio lo creamos y le ponemos el idtrabajador.
      if ( !ticketv ) {
	  BtTicket * tick = emp1->newBtTicket();
	  tick->setDbValue ( "idtrabajador", cur->value( "idtrabajador" ) );
	  emp1->setTicketActual ( tick );
	  emp1->listaTickets() ->append ( tick );
	  tick->pintar();
      }// end if
      
      /// Segun los privilegios que tenga el camarero le desabilitamos determinados objetos.
      if(cur->value("admintrabajador") == "t") {
	QToolButton *toolz = g_main->findChild<QToolButton *> ( "mui_z" );
	if (toolz) {
	    toolz->setEnabled(true);
	} // end if	

	QToolButton *toolx = g_main->findChild<QToolButton *> ( "mui_x" );
	if (toolx) {
	    toolx->setEnabled(true);
	} // end if	

	QToolButton *toolborraticket = g_main->findChild<QToolButton *> ( "mui_borrarticket" );
	if (toolborraticket) {
	    toolborraticket->setEnabled(true);
	} // end if

      } else {

	QToolButton *toolz = g_main->findChild<QToolButton *> ( "mui_z" );
	if (toolz) {
	    toolz->setEnabled(false);
	} // end if	
	
	QToolButton *toolx = g_main->findChild<QToolButton *> ( "mui_x" );
	if (toolx) {
	    toolx->setEnabled(false);
	} // end if	


	QToolButton *toolborraticket = g_main->findChild<QToolButton *> ( "mui_borrarticket" );
	if (toolborraticket) {
	    toolborraticket->setEnabled(false);
	} // end if
	
      } // end if
      
      delete cur;

      m_validUser = true;
      done ( 0 );
    } // end if
}
コード例 #22
0
ファイル: helpwindow.cpp プロジェクト: opieproject/opie
HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name )
    : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL()
{
    readHistory();
    readBookmarks();

    browser = new QTextBrowser( this );
    QStringList Strlist;
    Strlist.append( home_);

    browser->mimeSourceFactory()->setFilePath( Strlist );

    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&)) );

    setGeometry( 0,0,236,280);

    QPopupMenu* file = new QPopupMenu( this );
//    file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N );
    file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
//    file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P );
    file->insertSeparator();
    file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q );
//    file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X );

    // The same three icons are used twice each.
////F FIXME
    QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/";
    QIconSet icon_back( QPixmap(pixs+"back.png") );
    QIconSet icon_forward( QPixmap(pixs+"forward.png") );
    QIconSet icon_home( QPixmap(pixs+"home.png") );

    QPopupMenu* go = new QPopupMenu( this );
    backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left );
    forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right );
    go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );


    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( "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()->insertSeparator();
//      menuBar()->insertItem( tr("&Help"), 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("Backward"), "", browser, SLOT(backward()), toolbar );
    connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
    button->setEnabled( FALSE );
    button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
    connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
    button->setEnabled( FALSE );
    new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );

    toolbar->addSeparator();

    pathCombo = new QComboBox( TRUE, toolbar );
    connect( pathCombo, SIGNAL( activated(const QString&) ), this, SLOT( pathSelected(const QString&) ) );
    toolbar->setStretchableWidget( pathCombo );

//    pathCombo->setMaximumWidth(190);
//     setRightJustification( TRUE );
//      setDockEnabled( Left, FALSE );
//      setDockEnabled( Right, FALSE );

    pathCombo->insertItem( home_ );

    browser->setFocus();


}
コード例 #23
0
HelpWindow::HelpWindow( 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("&New Window"), this, SLOT( newWindow() ), ALT | Key_N );
    file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
    file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P );

    // The same three icons are used twice each.
    QIconSet icon_back( QPixmap("textdrawing/previous.png") );
    QIconSet icon_forward( QPixmap("textdrawing/next.png") );
    QIconSet icon_home( QPixmap("textdrawing/home.png") );

    QPopupMenu* go = new QPopupMenu( this );
    backwardId = go->insertItem( icon_back,
				 tr("&Backward"), browser, SLOT( backward() ),
				 ALT | Key_Left );
    forwardId = go->insertItem( icon_forward,
				tr("&Forward"), browser, SLOT( forward() ),
				ALT | Key_Right );
    go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );

    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( "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 ) ) );


    QToolBar* toolbar = new QToolBar( this );
    addToolBar( toolbar, "Toolbar");
    QToolButton* button;

    button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
    connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
    button->setEnabled( FALSE );
    button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
    connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
    button->setEnabled( FALSE );
    button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );

    toolbar->addSeparator();

    pathCombo = new QComboBox( TRUE, toolbar );
    connect( pathCombo, SIGNAL( activated( const QString & ) ),
	     this, SLOT( pathSelected( const QString & ) ) );
    toolbar->setStretchableWidget( pathCombo );
    setRightJustification( TRUE );
    setDockEnabled( DockLeft, FALSE );
    setDockEnabled( DockRight, FALSE );

    pathCombo->insertItem( home_ );

    browser->setFocus();
}
コード例 #24
0
ファイル: controller.cpp プロジェクト: Flameeyes/vlc
QFrame *AbstractController::telexFrame()
{
    /**
     * Telextext QFrame
     **/
    QFrame *telexFrame = new QFrame( this );
    QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
    telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );
    CONNECT( THEMIM->getIM(), teletextPossible( bool ),
             telexFrame, setVisible( bool ) );

    /* On/Off button */
    QToolButton *telexOn = new QToolButton;
    setupButton( telexOn );
    BUTTON_SET_BAR2( telexOn, toolbar/tv, qtr( "Teletext Activation" ) );
    telexOn->setEnabled( false );
    telexOn->setCheckable( true );

    telexLayout->addWidget( telexOn );

    /* Teletext Activation and set */
    CONNECT( telexOn, clicked( bool ),
             THEMIM->getIM(), activateTeletext( bool ) );
    CONNECT( THEMIM->getIM(), teletextPossible( bool ),
             telexOn, setEnabled( bool ) );

    /* Transparency button */
    QToolButton *telexTransparent = new QToolButton;
    setupButton( telexTransparent );
    BUTTON_SET_BAR2( telexTransparent, toolbar/tvtelx,
                     qtr( "Toggle Transparency " ) );
    telexTransparent->setEnabled( false );
    telexTransparent->setCheckable( true );
    telexLayout->addWidget( telexTransparent );

    /* Transparency change and set */
    CONNECT( telexTransparent, clicked( bool ),
            THEMIM->getIM(), telexSetTransparency( bool ) );
    CONNECT( THEMIM->getIM(), teletextTransparencyActivated( bool ),
             telexTransparent, setChecked( bool ) );


    /* Page setting */
    QSpinBox *telexPage = new QSpinBox( telexFrame );
    telexPage->setRange( 0, 999 );
    telexPage->setValue( 100 );
    telexPage->setAccelerated( true );
    telexPage->setWrapping( true );
    telexPage->setAlignment( Qt::AlignRight );
    telexPage->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
    telexPage->setEnabled( false );
    telexLayout->addWidget( telexPage );

    /* Page change and set */
    CONNECT( telexPage, valueChanged( int ),
            THEMIM->getIM(), telexSetPage( int ) );
    CONNECT( THEMIM->getIM(), newTelexPageSet( int ),
            telexPage, setValue( int ) );

    CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexPage, setEnabled( bool ) );
    CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexTransparent, setEnabled( bool ) );
    CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexOn, setChecked( bool ) );
    return telexFrame;
}
コード例 #25
0
ファイル: controller.cpp プロジェクト: r1k/vlc
QFrame *AbstractController::telexFrame()
{
    /**
     * Telextext QFrame
     **/
    QFrame *telexFrame = new QFrame( this );
    QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
    telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );
    CONNECT( THEMIM->getIM(), teletextPossible( bool ),
             telexFrame, setVisible( bool ) );

    /* On/Off button */
    QToolButton *telexOn = new QToolButton;
    setupButton( telexOn );
    BUTTON_SET_BAR2( telexOn, toolbar/tv, qtr( "Teletext Activation" ) );
    telexOn->setEnabled( false );
    telexOn->setCheckable( true );

    telexLayout->addWidget( telexOn );

    /* Teletext Activation and set */
    CONNECT( telexOn, clicked( bool ),
             THEMIM->getIM(), activateTeletext( bool ) );
    CONNECT( THEMIM->getIM(), teletextPossible( bool ),
             telexOn, setEnabled( bool ) );

    /* Transparency button */
    QToolButton *telexTransparent = new QToolButton;
    setupButton( telexTransparent );
    BUTTON_SET_BAR2( telexTransparent, toolbar/tvtelx,
                     qtr( "Toggle Transparency " ) );
    telexTransparent->setEnabled( false );
    telexTransparent->setCheckable( true );
    telexLayout->addWidget( telexTransparent );

    /* Transparency change and set */
    CONNECT( telexTransparent, clicked( bool ),
            THEMIM->getIM(), telexSetTransparency( bool ) );
    CONNECT( THEMIM->getIM(), teletextTransparencyActivated( bool ),
             telexTransparent, setChecked( bool ) );


    /* Page setting */
    QSpinBox *telexPage = new QSpinBox( telexFrame );
    telexPage->setRange( 100, 899 );
    telexPage->setValue( 100 );
    telexPage->setAccelerated( true );
    telexPage->setWrapping( true );
    telexPage->setAlignment( Qt::AlignRight );
    telexPage->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
    telexPage->setEnabled( false );
    telexLayout->addWidget( telexPage );

    /* Contextual & Index Buttons */
    QSignalMapper *contextButtonMapper = new QSignalMapper( this );
    QToolButton *contextButton = NULL;
    int i_iconminsize = __MAX( 16, telexOn->minimumHeight() );
    QPixmap iconPixmap( i_iconminsize, i_iconminsize );
    iconPixmap.fill( Qt::transparent );
    QPainter iconPixmapPainter( &iconPixmap );
    QLinearGradient iconPixmapPainterGradient( iconPixmap.rect().center() / 2,
                                               iconPixmap.rect().center() );

#define CREATE_CONTEXT_BUTTON(color, key) \
    iconPixmapPainterGradient.setColorAt( 0, QColor( color ).lighter(150) );\
    iconPixmapPainterGradient.setColorAt( 1.0, QColor( color ) );\
    iconPixmapPainter.setBrush( iconPixmapPainterGradient );\
    iconPixmapPainter.drawEllipse( iconPixmap.rect().adjusted( 4, 4, -5, -5 ) );\
    contextButton = new QToolButton();\
    setupButton( contextButton );\
    contextButton->setIcon( iconPixmap );\
    contextButton->setEnabled( false );\
    contextButtonMapper->setMapping( contextButton, key << 16 );\
    CONNECT( contextButton, clicked(), contextButtonMapper, map() );\
    CONNECT( contextButtonMapper, mapped( int ),\
             THEMIM->getIM(), telexSetPage( int ) );\
    CONNECT( THEMIM->getIM(), teletextActivated( bool ), contextButton, setEnabled( bool ) );\
    telexLayout->addWidget( contextButton )

    CREATE_CONTEXT_BUTTON("grey", 'i'); /* index */
    CREATE_CONTEXT_BUTTON("red", 'r');
    CREATE_CONTEXT_BUTTON("green", 'g');
    CREATE_CONTEXT_BUTTON("yellow", 'y');
    CREATE_CONTEXT_BUTTON("blue", 'b');

#undef CREATE_CONTEXT_BUTTON

    /* Page change and set */
    CONNECT( telexPage, valueChanged( int ),
            THEMIM->getIM(), telexSetPage( int ) );
    CONNECT( THEMIM->getIM(), newTelexPageSet( int ),
            telexPage, setValue( int ) );

    CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexPage, setEnabled( bool ) );
    CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexTransparent, setEnabled( bool ) );
    CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexOn, setChecked( bool ) );
    return telexFrame;
}
コード例 #26
0
ファイル: itemsviewdelegate.cpp プロジェクト: KDE/knewstuff
void ItemsViewDelegate::updateItemWidgets(const QList<QWidget *> widgets,
        const QStyleOptionViewItem &option,
        const QPersistentModelIndex &index) const
{
    const KNSCore::ItemsModel *model = qobject_cast<const KNSCore::ItemsModel *>(index.model());
    if (!model) {
        qCDebug(KNEWSTUFF) << "WARNING - INVALID MODEL!";
        return;
    }

    KNSCore::EntryInternal entry = index.data(Qt::UserRole).value<KNSCore::EntryInternal>();

    // setup the install button
    int margin = option.fontMetrics.height() / 2;
    int right = option.rect.width();

    QToolButton *installButton = qobject_cast<QToolButton *>(widgets.at(DelegateInstallButton));
    if (installButton != 0) {

        if (installButton->menu()) {
            QMenu *buttonMenu = installButton->menu();
            buttonMenu->clear();
            installButton->setMenu(0);
            buttonMenu->deleteLater();
        }

        bool installable = false;
        bool enabled = true;
        QString text;
        QIcon icon;

        switch (entry.status()) {
        case Entry::Installed:
            text = i18n("Uninstall");
            icon = m_iconDelete;
            break;
        case Entry::Updateable:
            text = i18n("Update");
            icon = m_iconUpdate;
            installable = true;
            break;
        case Entry::Installing:
            text = i18n("Installing");
            enabled = false;
            icon = m_iconUpdate;
            break;
        case Entry::Updating:
            text = i18n("Updating");
            enabled = false;
            icon = m_iconUpdate;
            break;
        case Entry::Downloadable:
            text = i18n("Install");
            icon = m_iconInstall;
            installable = true;
            break;
        case Entry::Deleted:
            text = i18n("Install Again");
            icon = m_iconInstall;
            installable = true;
            break;
        default:
            text = i18n("Install");
        }
        installButton->setText(text);
        installButton->setEnabled(enabled);
        installButton->setIcon(icon);
        if (installable && entry.downloadLinkCount() > 1) {
            QMenu *installMenu = new QMenu(installButton);
            foreach (const KNSCore::EntryInternal::DownloadLinkInformation &info, entry.downloadLinkInformationList()) {
                QString text = info.name;
                if (!info.distributionType.trimmed().isEmpty()) {
                    text + " (" + info.distributionType.trimmed() + ')';
                }
                QAction *installAction = installMenu->addAction(m_iconInstall, text);
                installAction->setData(QPoint(index.row(), info.id));
            }
            installButton->setMenu(installMenu);
        }
    }