Example #1
0
void
MacMenu::manage(QMenuBar *menu)
{
    if (!menu) // ...
        return;
    
    // we only accept menus that are placed on a QMainWindow - for the moment, and probably ever
    QWidget *dad = menu->parentWidget();
    if (!(dad && dad->isWindow() && dad->inherits("QMainWindow") && dad->layout() && dad->layout()->menuBar() == menu))
        return;

//     if ((dad = dad->parentWidget()) && dad->inherits("QMdiSubWindow"))
//         return;
    

    if (!instance)
    {
        instance = new MacMenu;
        /*MacMenuAdaptor *adapt = */new MacMenuAdaptor(instance);
        fullscreenWatcher = new FullscreenWatcher;
    }
    else if (instance->items.contains(menu))
        return; // no double adds please!

    if (instance->usingMacMenu)
        instance->activate(menu);

    connect (menu, SIGNAL(destroyed(QObject *)), instance, SLOT(_release(QObject *)));

    instance->items.append(menu);
}
Example #2
0
/** ***************************************************************************/
void SettingsWidget::updatePluginInformations(const QModelIndex & current) {
    // Hidde the placehodler text
    QLayoutItem *i = ui.widget_pluginInfos->layout()->takeAt(1);
    delete i->widget();
    delete i;

    if (extensionManager_->extensionSpecs()[current.row()]->state() == ExtensionSpec::State::Loaded){
        Extension *extension = dynamic_cast<Extension*>(extensionManager_->extensionSpecs()[current.row()]->instance());
        if (!extension){
            qWarning() << "Cannot cast an object of extension spec to an extension!";
            return; // Should no happen
        }
        QWidget *pw = extension->widget();
        if ( pw->layout() != nullptr)
            pw->layout()->setMargin(0);
        ui.widget_pluginInfos->layout()->addWidget(pw);// Takes ownership
        ui.label_pluginTitle->setText(extension->name());
        ui.label_pluginTitle->show();
    }
    else{
        QString msg("Plugin not loaded.\n%1");
        QLabel *lbl = new QLabel(msg.arg(extensionManager_->extensionSpecs()[current.row()]->lastError()));
        lbl->setEnabled(false);
        lbl->setAlignment(Qt::AlignCenter);
        ui.widget_pluginInfos->layout()->addWidget(lbl);
        ui.label_pluginTitle->hide();
    }
}
Example #3
0
int main(int argc, char *argv[])
{
	QApplication app(argc, argv);
//#define ABC
#ifdef ABC
	ParameterWidget *pw = new ParameterWidget();
	pw->setProperties( "a", FloatParameterProperties() );
	pw->setProperties( "b", FloatParameterProperties() );
	pw->setProperties( "c", FloatParameterProperties() );
	pw->setProperties( "d", FloatParameterProperties() );
	pw->show();
#else
	QTabWidget *tw = new QTabWidget();

	QScrollArea *sa = new QScrollArea( );
	sa->setWidgetResizable( true );

	QWidget *w = new QWidget(  );
	w->setLayout( new QVBoxLayout() );
	w->layout()->addWidget( new CoordinateSystemWidget( "a", FloatParameterProperties(), "b", FloatParameterProperties(), w ) );
	( ( QVBoxLayout * ) w->layout() )->addStretch();

	sa->setWidget( w );

	tw->addTab( sa, "bla" );
	tw->show();

	app.processEvents();
	w->layout()->addWidget( new CoordinateSystemWidget() );
#endif

	return app.exec();
}
Example #4
0
void AccordionFrame::animatedShow()
{
    if (isVisible()) {
        show();
        return;
    }

    if (!display_is_remote()) {
        QWidget *parent = parentWidget();

        if (parent && parent->layout()) {
            // Force our parent layout to update its geometry. There are a number
            // of ways of doing this. Calling invalidate + activate seems to
            // be the best.
            show();
            parent->layout()->invalidate(); // Calls parent->layout()->update()
            parent->layout()->activate(); // Calculates sizes then calls parent->updateGeometry()
            frame_height_ = height();
            hide();
        }
        if (frame_height_ > 0) {
            animation_->setStartValue(0);
            animation_->setEndValue(frame_height_);
            animation_->start();
        }
    }
    show();
}
Example #5
0
void EmbeddedWebView::findScrollParent()
{
    if (m_scrollParent)
        m_scrollParent->removeEventFilter(this);
    m_scrollParent = 0;
    m_scrollParentPadding = 4;
    QWidget *runner = this;
    int left, top, right, bottom;
    while (runner) {
        runner->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
        runner->getContentsMargins(&left, &top, &right, &bottom);
        m_scrollParentPadding += left + right + 4;
        if (runner->layout()) {
            runner->layout()->getContentsMargins(&left, &top, &right, &bottom);
            m_scrollParentPadding += left + right;
        }
        QWidget *p = runner->parentWidget();
        if (p && qobject_cast<MessageView*>(runner) && // is this a MessageView?
            p->objectName() == "qt_scrollarea_viewport" && // in a viewport?
            qobject_cast<QAbstractScrollArea*>(p->parentWidget())) { // that is used?
            p->getContentsMargins(&left, &top, &right, &bottom);
            m_scrollParentPadding += left + right + 4;
            if (p->layout()) {
                p->layout()->getContentsMargins(&left, &top, &right, &bottom);
                m_scrollParentPadding += left + right;
            }
            m_scrollParent = p->parentWidget();
            break; // then we have our actual message view
        }
        runner = p;
    }
    m_scrollParentPadding += style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, m_scrollParent);
    if (m_scrollParent)
        m_scrollParent->installEventFilter(this);
}
/*! create editor for tree widget item
*/
QWidget *
CQPropertyDelegate::
createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const
{
  QTreeWidgetItem *item = getModelItem(index);
  assert(item);

  CQPropertyDelegate *th = const_cast<CQPropertyDelegate *>(this);

  QWidget *w = 0;

  if (CQPropertyItem::isType(item->type())) {
    CQPropertyItem *item1 = dynamic_cast<CQPropertyItem *>(item);
    assert(item1);

    if (index.column() == 1)
      w = item1->createEditor(parent);
  }
  else
    assert(false);

  if (w) {
    w->updateGeometry();

    if (w->layout())
      w->layout()->invalidate();

    //w->setFixedSize(sizeHint(option, index));

    w->installEventFilter(th);
  }

  return w;
}
Example #7
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , server(new QLocalServer(this))
    , tabWidget(new QTabWidget)
    , defaultSession(new SessionWidget)
{
    setCentralWidget(tabWidget);

    QString sockName("pipeit_gui_server");

    // to do: add this as button in the error message mode
    QLocalServer::removeServer(sockName);

    if (!server->listen(sockName)) {
        QWidget *w = new QWidget;
        w->setLayout(new QVBoxLayout());
        w->layout()->addWidget(
                    new QLabel(
                        tr("Listening on local socket '%1' failed: %2")
                        .arg(sockName).arg(server->errorString())));
        QPushButton *b = new QPushButton(tr("Quit"));
        w->layout()->addWidget(b);

        connect(b, SIGNAL(clicked()), qApp, SLOT(quit()));
        tabWidget->addTab(w, tr("*ERROR*"));
    }
    else {
        tabWidget->addTab(defaultSession, "DEFAULT");
        connect(server, SIGNAL(newConnection()), SLOT(handleConnection()));
    }
}
/*protected*/ QWidget* SignalHeadItemPanel::initTablePanel(PickListModel* model, Editor* /*editor*/)
{
 _table = model->makePickTable();
 ROW_HEIGHT = _table->getRowHeight();
 QWidget* topPanel = new QWidget();
 //topPanel->setLayout(new BorderLayout);
 topPanel->setLayout(new QVBoxLayout);
 //((BorderLayout*)topPanel->layout())->addWidget(new QLabel(model->getName()/*, SwingConstants.CENTER*/), BorderLayout::North);
 ((QVBoxLayout*)topPanel->layout())->addWidget(new QLabel(model->getName()),0, Qt::AlignTop);
    //_scrollPane = new JScrollPane(_table);
 //((BorderLayout*)topPanel->layout())->addWidget(/*_scrollPane,*/_table, BorderLayout::Center);
 ((QVBoxLayout*)topPanel->layout())->addWidget(/*_scrollPane,*/_table, 0, Qt::AlignVCenter);
//    _table->getSelectionModel().addListSelectionListener(this);
 _table->setToolTip(tr("Drag a row from the table to add a label of the item to the panel"));
    //_scrollPane->setToolTip(tr("Drag a row from the table to add a label of the item to the panel"));
 topPanel->setToolTip(tr("Drag a row from the table to add a label of the item to the panel"));
 QWidget* panel = new QWidget();
 panel->setLayout(new FlowLayout);
 QPushButton* clearSelectionButton = new QPushButton(tr("Clear Selection"));
//    clearSelectionButton.addActionListener(new ActionListener() {
//            /*public*/ void actionPerformed(ActionEvent a) {
//                _table.clearSelection();
//            }
//    });
 connect(clearSelectionButton, SIGNAL(clicked()), _table, SLOT(clearSelection()));
 clearSelectionButton->setToolTip(tr("Clear selected table rows"));
 panel->layout()->addWidget(clearSelectionButton);
// ((BorderLayout*)topPanel->layout())->addWidget(panel, BorderLayout::South);
 //((BorderLayout*)topPanel->layout())->addWidget(panel, BorderLayout::South);
 ((QVBoxLayout*)topPanel->layout())->addWidget(panel,0, Qt::AlignBottom);
 return topPanel;
}
ValidatorsDialog::ValidatorsDialog(QWidget *parent )
  : KPageDialog( parent)
{
  setButtons(Ok|Cancel);
  setDefaultButton(Ok);
  setModal(false);
  showButtonSeparator(true);
  setCaption(i18nc("@title:window", "Configure Validator Plugin"));
  setMinimumWidth(400);

#ifdef HAVE_TIDY
  QWidget* internalConfiguration = new QWidget();
  m_internalUi.setupUi(internalConfiguration);
  internalConfiguration->layout()->setMargin(0);
  KPageWidgetItem *internalConfigurationItem = addPage(internalConfiguration, i18n("Internal Validation"));
  internalConfigurationItem->setIcon(KIcon("validators"));
#endif

  QWidget* remoteConfiguration = new QWidget();
  m_remoteUi.setupUi(remoteConfiguration);
  remoteConfiguration->layout()->setMargin(0);
  KPageWidgetItem *remoteConfigurationItem = addPage(remoteConfiguration, i18n("Remote Validation"));
  remoteConfigurationItem->setIcon(KIcon("validators"));

  connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
  connect(this,SIGNAL(cancelClicked()),this,SLOT(slotCancel()));
  load();
}
Example #10
0
static QSize smartMinSize( const QWidgetItem *i )
{
    QWidget *w = ( (QWidgetItem*)i )->widget();
    QSize s(0,0);
    if ( w->layout() ) {
	s = w->layout()->totalMinimumSize();
    } else {
	QSize sh;
	if ( w->sizePolicy().mayShrinkHorizontally() )
	    s.setWidth( w->minimumSizeHint().width() );
	else {
	    sh = w->sizeHint();
	    s.setWidth( sh.width() );
	}
	if ( w->sizePolicy().mayShrinkVertically() )
	    s.setHeight( w->minimumSizeHint().height() );
	else
	    s.setHeight( sh.isValid() ? sh.height() : w->sizeHint().height() );
    }
    s = s.boundedTo( w->maximumSize() );
    QSize min = w->minimumSize();
    if ( min.width() > 0 )
	s.setWidth( min.width() );
    if ( min.height() > 0 )
	s.setHeight( min.height() );

    if ( i->hasHeightForWidth() && min.height() == 0 && min.width() > 0 )
	s.setHeight( i->heightForWidth( s.width() ) );
    
    s = s.expandedTo( QSize(1,1) );
    return s;
}
Example #11
0
QWidget* MainWindow::setupScriptPanel()
{
    m_hScriptSplitter = new QSplitter(this);
    m_hScriptSplitter->setOrientation(Qt::Horizontal);

    KToolBar *executeCommands = new KToolBar(this);
    executeCommands->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    executeCommands->setOrientation(Qt::Vertical);
    m_runScript = new QAction(QIcon::fromTheme("media-playback-start"), i18nc("@action:intoolbar Script Execution", "Run"), this);
    m_runScript->setToolTip(i18nc("@info:tooltip", "Execute currently active script on active graph document."));
    m_stopScript = new QAction(QIcon::fromTheme("process-stop"), i18nc("@action:intoolbar Script Execution", "Stop"), this);
    m_stopScript->setToolTip(i18nc("@info:tooltip", "Stop script execution."));
    m_stopScript->setEnabled(false);
    executeCommands->addAction(m_runScript);
    executeCommands->addAction(m_stopScript);
    // add actions to action collection to be able to set shortcuts on them in the ui
    actionCollection()->addAction("_runScript", m_runScript);
    actionCollection()->addAction("_stopScript", m_stopScript);

    connect(m_runScript, &QAction::triggered, this, &MainWindow::executeScript);
    connect(m_stopScript, &QAction::triggered, this, &MainWindow::stopScript);

    m_hScriptSplitter->addWidget(m_codeEditorWidget);
    m_hScriptSplitter->addWidget(m_outputWidget);

    QWidget *scriptInterface = new QWidget(this);
    scriptInterface->setLayout(new QHBoxLayout);
    scriptInterface->layout()->addWidget(m_hScriptSplitter);
    scriptInterface->layout()->addWidget(executeCommands);

    return scriptInterface;
}
Example #12
0
ShortcutDialog::ShortcutDialog(const QKeySequence& cut)
    : _shortcut(cut)
{
    QWidget *vBoxContainer = new QWidget(this);
    vBoxContainer->setLayout(new QVBoxLayout(vBoxContainer));
    vBoxContainer->layout()->addWidget(widget = new KKeySequenceWidget(vBoxContainer));
    vBoxContainer->layout()->addWidget(warning = new QLabel(vBoxContainer));
    warning->hide();
    widget->setKeySequence(cut);

    // To not check for conflicting shortcuts. The widget would use a message
    // box which brings down kwin.
    widget->setCheckForConflictsAgainst(KKeySequenceWidget::None);
    // It's a global shortcut so don't allow multikey shortcuts
    widget->setMultiKeyShortcutsAllowed(false);

    // Listen to changed shortcuts
    connect(
        widget, SIGNAL(keySequenceChanged(QKeySequence)),
        SLOT(keySequenceChanged(QKeySequence)));

    setMainWidget(vBoxContainer);
    widget->setFocus();

    // make it a popup, so that it has the grab
    XSetWindowAttributes attrs;
    attrs.override_redirect = True;
    XChangeWindowAttributes(display(), winId(), CWOverrideRedirect, &attrs);
    setWindowFlags(Qt::Popup);
}
void ContainerBuilder::setParent(::fwGui::container::fwContainer::sptr parent)
{
    SLM_ASSERT("Sorry, QtContainer not yet initialized, cleaning impossible", m_container);
    ::fwGuiQt::container::QtContainer::sptr parentContainer = ::fwGuiQt::container::QtContainer::dynamicCast(parent);
    SLM_ASSERT("dynamicCast fwContainer to QtContainer failed", parentContainer);
    ::fwGuiQt::container::QtContainer::sptr container = ::fwGuiQt::container::QtContainer::dynamicCast(m_container);
    SLM_ASSERT("dynamicCast fwContainer to QtContainer failed", container);

    QWidget *qtContainer = container->getQtContainer();
    SLM_ASSERT("Sorry, QtContainer not yet initialized", qtContainer);
    QWidget *qtParent = parentContainer->getQtContainer();
    SLM_ASSERT("Sorry, parent QtContainer not yet initialized", qtParent);

    if(qtParent != m_parent->getQtContainer() )
    {
        if(!qtParent->layout())
        {
            SLM_TRACE("New parent container hasn't layout");
            QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom);
            layout->setContentsMargins(0, 0, 0, 0);
            qtParent->setLayout(layout);
        }
        qtParent->layout()->addWidget(qtContainer);
        qtContainer->update();

        m_parent = parentContainer;
    }
}
Example #14
0
void
TomahawkWindow::setupSideBar()
{
    // Delete fake designer widgets
    delete ui->sidebarWidget;
    delete ui->playlistWidget;

    QWidget* sidebarWidget = new QWidget();
    sidebarWidget->setLayout( new QVBoxLayout() );

    m_sidebar = new AnimatedSplitter();
    m_sidebar->setOrientation( Qt::Vertical );
    m_sidebar->setChildrenCollapsible( false );

    m_searchWidget = new QSearchField( m_sidebar );
    m_searchWidget->setPlaceholderText( tr( "Global Search..." ) );
    connect( m_searchWidget, SIGNAL( returnPressed() ), this, SLOT( onFilterEdited() ) );

    m_sourcetree = new SourceTreeView();
    JobStatusView* jobsView = new JobStatusView( m_sidebar );
    m_jobsModel = new JobStatusModel( jobsView );
    jobsView->setModel( m_jobsModel );

    m_queueView = new QueueView( m_sidebar );
    m_queueModel = new PlaylistModel( m_queueView );
    m_queueModel->setStyle( PlaylistModel::Short );
    m_queueView->queue()->setPlaylistModel( m_queueModel );
    m_queueView->queue()->playlistModel()->setReadOnly( false );
    AudioEngine::instance()->setQueue( m_queueView->queue()->proxyModel() );

    m_sidebar->addWidget( m_searchWidget );
    m_sidebar->addWidget( m_sourcetree );
    m_sidebar->addWidget( jobsView );
    m_sidebar->addWidget( m_queueView );

    m_sidebar->setGreedyWidget( 1 );
    m_sidebar->hide( 1, false );
    m_sidebar->hide( 2, false );
    m_sidebar->hide( 3, false );
    m_sidebar->hide( 4, false );

    sidebarWidget->layout()->addWidget( m_sidebar );
    sidebarWidget->setContentsMargins( 0, 0, 0, 0 );
    sidebarWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
    sidebarWidget->layout()->setMargin( 0 );

#ifndef Q_WS_MAC
    sidebarWidget->layout()->setSpacing( 0 );
#endif

    ui->splitter->addWidget( sidebarWidget );
    ui->splitter->addWidget( ViewManager::instance()->widget() );

    ui->splitter->setStretchFactor( 0, 1 );
    ui->splitter->setStretchFactor( 1, 3 );
    ui->splitter->setCollapsible( 1, false );

    ui->actionShowOfflineSources->setChecked( TomahawkSettings::instance()->showOfflineSources() );
}
BaseTreeDock::BaseTreeDock(QString window_title, QString object_name, bool requires_refresh, QWidget *parent, Qt::WindowFlags flags)
    : BaseDock(parent, flags)
    , m_collapsed(true)
{
    setWindowTitle(window_title);
    setObjectName(object_name);
    setFeatures(QDockWidget::AllDockWidgetFeatures);
    setAllowedAreas(Qt::AllDockWidgetAreas);

    m_arr_in = QIcon(":img/arrow-in.png");
    m_arr_out = QIcon(":img/arrow-out.png");

    QWidget *w = new QWidget();
    QVBoxLayout *l = new QVBoxLayout();
    w->setLayout(l);

    m_tree_view = new QTreeWidget(this);
    m_tree_view->setEditTriggers(QAbstractItemView::NoEditTriggers);
    m_tree_view->setDropIndicatorShown(false);
    m_tree_view->setProperty("showSortIndicator",QVariant(true));
    m_tree_view->setSelectionMode(QAbstractItemView::ExtendedSelection);

    QHBoxLayout *s = new QHBoxLayout();
    QLabel *lbl_search = new QLabel(tr("Search"),this);
    s->addWidget(lbl_search);
    m_le_search = new QLineEdit(this);
    m_le_search->setObjectName("le_search");
    s->addWidget(m_le_search);

    m_btn_toggle_tree = new QPushButton(this);
    m_btn_toggle_tree->setIcon(m_arr_out);
    s->addWidget(m_btn_toggle_tree);

    QPushButton *btn_clear_search = new QPushButton(this);
    QIcon icn_cross(":img/cross.png");
    btn_clear_search->setIcon(icn_cross);
    s->addWidget(btn_clear_search);

    l->addLayout(s);

    QPushButton *btn = new QPushButton(tr("Clear Filter"),this);
    w->layout()->addWidget(m_tree_view);
    w->layout()->addWidget(btn);

    setWidget(w);

    connect(btn, SIGNAL(clicked()),this,SLOT(clear_filter()));
    connect(m_le_search, SIGNAL(textChanged(QString)), this, SLOT(search_changed(QString)));
    connect(btn_clear_search, SIGNAL(clicked()),this,SLOT(clear_search()));
    connect(m_btn_toggle_tree, SIGNAL(clicked()), this, SLOT(toggle_tree()));
    connect(m_tree_view, SIGNAL(itemSelectionChanged()), this, SLOT(selection_changed()));

    m_requires_refresh = requires_refresh;

    if(DT){
        connect(DT,SIGNAL(units_refreshed()),this,SLOT(refresh()));
    }
}
Example #16
0
QWidget* QgsAttributeTableView::createActionWidget( QgsFeatureId fid )
{
  QgsAttributeTableConfig attributeTableConfig = mFilterModel->layer()->attributeTableConfig();
  QgsActionManager* actions = mFilterModel->layer()->actions();

  QToolButton* toolButton = nullptr;
  QWidget* container = nullptr;

  if ( attributeTableConfig.actionWidgetStyle() == QgsAttributeTableConfig::DropDown )
  {
    toolButton  = new QToolButton( this );
    toolButton->setPopupMode( QToolButton::MenuButtonPopup );
    container = toolButton;
  }
  else
  {
    container = new QWidget( this );
    container->setLayout( new QHBoxLayout() );
    container->layout()->setMargin( 0 );
  }

  for ( int i = 0; i < actions->size(); ++i )
  {
    const QgsAction& action = actions->at( i );

    if ( !action.showInAttributeTable() )
      continue;

    QAction* act = new QAction( action.icon(), action.shortTitle().isEmpty() ? action.name() : action.shortTitle(), toolButton );
    act->setToolTip( action.name() );
    act->setData( i );
    act->setProperty( "fid", fid );

    connect( act, SIGNAL( triggered( bool ) ), this, SLOT( actionTriggered() ) );

    if ( attributeTableConfig.actionWidgetStyle() == QgsAttributeTableConfig::DropDown )
    {
      toolButton->addAction( act );

      if ( actions->defaultAction() == i )
        toolButton->setDefaultAction( act );

      container = toolButton;
    }
    else
    {
      QToolButton* btn = new QToolButton;
      btn->setDefaultAction( act );
      container->layout()->addWidget( btn );
    }
  }

  if ( toolButton && !toolButton->actions().isEmpty() && actions->defaultAction() == -1 )
    toolButton->setDefaultAction( toolButton->actions().first() );

  return container;
}
Example #17
0
void TestBox::initSizeLabel()
{
    QWidget* cont = new QWidget();
    cont->setLayout(new QVBoxLayout());
    cont->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
    cont->layout()->addWidget(sizeLabel);
    cont->layout()->addWidget(minSizeLabel);
    layout()->addWidget(cont);
}
Example #18
0
QgsWelcomePage::QgsWelcomePage( QWidget* parent )
    : QTabWidget( parent )
{
  QVBoxLayout* mainLayout = new QVBoxLayout;
  mainLayout->setMargin( 0 );
  setLayout( mainLayout );

  QHBoxLayout* layout = new QHBoxLayout();
  layout->setMargin( 9 );

  mainLayout->addLayout( layout );

  QWidget* recentProjctsContainer = new QWidget;
  recentProjctsContainer->setLayout( new QVBoxLayout );
  QLabel* recentProjectsTitle = new QLabel( QString( "<h1>%1</h1>" ).arg( tr( "Recent Projects" ) ) );
  recentProjctsContainer->layout()->addWidget( recentProjectsTitle );

  QListView* recentProjectsListView = new QListView();
  mModel = new QgsWelcomePageItemsModel( recentProjectsListView );
  recentProjectsListView->setModel( mModel );
  recentProjectsListView->setItemDelegate( new QgsWelcomePageItemDelegate( recentProjectsListView ) );

  recentProjctsContainer->layout()->addWidget( recentProjectsListView );

  addTab( recentProjctsContainer, "Recent Projects" );

  QWidget* whatsNewContainer = new QWidget;
  whatsNewContainer->setLayout( new QVBoxLayout );
  QLabel* whatsNewTitle = new QLabel( QString( "<h1>%1</h1>" ).arg( tr( "QGIS News" ) ) );
  whatsNewContainer->layout()->addWidget( whatsNewTitle );

  QgsWebView* whatsNewPage = new QgsWebView();
  whatsNewPage->setUrl( QUrl::fromLocalFile( QgsApplication::whatsNewFilePath() ) );
  whatsNewPage->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
  whatsNewPage->setContextMenuPolicy( Qt::NoContextMenu );
  whatsNewPage->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
  whatsNewPage->setStyleSheet( "background:transparent" );
  whatsNewPage->setAttribute( Qt::WA_TranslucentBackground );

  whatsNewContainer->layout()->addWidget( whatsNewPage );
//  whatsNewContainer->setMaximumWidth( 250 );
//  whatsNewContainer->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
  addTab( whatsNewContainer, "News" );

  connect( whatsNewPage, SIGNAL( linkClicked( QUrl ) ), this, SLOT( whatsNewLinkClicked( QUrl ) ) );

  mVersionInformation = new QLabel;
  mainLayout->addWidget( mVersionInformation );
  mVersionInformation->setVisible( false );

  mVersionInfo = new QgsVersionInfo();
  connect( mVersionInfo, SIGNAL( versionInfoAvailable() ), this, SLOT( versionInfoReceived() ) );
  mVersionInfo->checkVersion();

  connect( recentProjectsListView, SIGNAL( activated( QModelIndex ) ), this, SLOT( itemActivated( QModelIndex ) ) );
}
Example #19
0
static ExpandableGroupBox *createGroupBox(QString name, bool root = false) {
  ExpandableGroupBox *groupBox = new ExpandableGroupBox(nullptr, name);
  groupBox->setObjectName(name);
  groupBox->setProperty("root", root);
  QWidget *groupWidget = new QWidget();
  groupWidget->setLayout(new QVBoxLayout);
  groupWidget->layout()->setContentsMargins(0, 15, 0, 6);
  groupWidget->layout()->setSpacing(0);
  groupBox->setWidget(groupWidget);
  return groupBox;
}
ThoughtsDock::ThoughtsDock(QWidget *parent, Qt::WindowFlags flags)
    : BaseDock(parent, flags)
{
    setWindowTitle(tr("Thoughts"));
    setObjectName("dock_thoughts");
    setFeatures(QDockWidget::AllDockWidgetFeatures);
    setAllowedAreas(Qt::AllDockWidgetAreas);

    QWidget *w = new QWidget();
    QVBoxLayout *l = new QVBoxLayout();
    w->setLayout(l);

    // THOUGHTS TABLE
    tw_thoughts = new QTableWidget(this);
    tw_thoughts->setColumnCount(3);
    tw_thoughts->setEditTriggers(QTableWidget::NoEditTriggers);
    tw_thoughts->setWordWrap(true);
    tw_thoughts->setShowGrid(false);
    tw_thoughts->setGridStyle(Qt::NoPen);
    tw_thoughts->setAlternatingRowColors(true);
    tw_thoughts->setSelectionMode(QAbstractItemView::ExtendedSelection);
    tw_thoughts->setSelectionBehavior(QAbstractItemView::SelectRows);
    tw_thoughts->setHorizontalHeaderLabels(QStringList() << "Thought" << "Count" << "Description");
    tw_thoughts->verticalHeader()->hide();
    tw_thoughts->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Interactive);
    tw_thoughts->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Interactive);
    tw_thoughts->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Interactive);
    tw_thoughts->setColumnWidth(0,100);
    tw_thoughts->setColumnWidth(1,50);
    tw_thoughts->horizontalHeader()->setStretchLastSection(true);

    QHBoxLayout *s = new QHBoxLayout();
    QLabel *lbl_search = new QLabel("Search",this);
    s->addWidget(lbl_search);
    QLineEdit *le_search = new QLineEdit(this);
    le_search->setObjectName("le_search");
    s->addWidget(le_search);
    QPushButton *btn_clear_search = new QPushButton(this);
    QIcon icn(":img/cross.png");
    btn_clear_search->setIcon(icn);
    s->addWidget(btn_clear_search);
    l->addLayout(s);

    QPushButton *btn = new QPushButton("Clear Filter",this);
    w->layout()->addWidget(tw_thoughts);
    w->layout()->addWidget(btn);

    setWidget(w);

    connect(tw_thoughts,SIGNAL(itemSelectionChanged()),this,SLOT(selection_changed()));
    connect(btn, SIGNAL(clicked()),this,SLOT(clear_filter()));
    connect(le_search, SIGNAL(textChanged(QString)),this, SLOT(search_changed(QString)));
    connect(btn_clear_search, SIGNAL(clicked()),this,SLOT(clear_search()));
}
Example #21
0
void
MacMenu::deactivate(QMenuBar *menu)
{
    menu->removeEventFilter(this);
    QWidget *dad = menu->parentWidget();
    if (dad && dad->layout())
        dad->layout()->setMenuBar(menu);
    menu->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
    menu->adjustSize();
    //             menu->updateGeometry();
}
Example #22
0
void SummaryWidget::createDiskMaps()
{
    DiskList disks;

    const Q3CString free = i18n("Free").toLocal8Bit();
    const Q3CString used = i18n("Used").toLocal8Bit();

    KIconLoader loader;

    oldScheme = Config::scheme;
    Config::scheme = (Filelight::MapScheme)2000;

    for (DiskList::ConstIterator it = disks.begin(), end = disks.end(); it != end; ++it)
    {
        Disk const &disk = *it;

        if (disk.free == 0 && disk.used == 0)
            continue;

        QWidget *box = new QWidget(this);
        box->setLayout(new QVBoxLayout(box));
        //box->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
        RadialMap::Widget *map = new MyRadialMap(box);

//        QString text; QTextOStream(&text)
//            << "<img src='" << loader.iconPath(disk.icon, KIconLoader::Toolbar) << "'>"
//            << " &nbsp;" << disk.mount << " "
//            << "<i>(" << disk.device << ")</i>";

        QGridLayout* horizontalLayout = new QGridLayout(box);

        QLabel *icon = new QLabel(box);
        icon->setPixmap(KIcon(disk.icon).pixmap(32,32));
        horizontalLayout->addWidget(icon);

        QLabel *label = new QLabel(disk.mount + " (" + disk.device + ")", box);
        label->setAlignment(Qt::AlignCenter);
        horizontalLayout->addWidget(label);

        box->layout()->addWidget(map);
        box->layout()->addItem(horizontalLayout);

        layout()->addWidget(box);
        //box->show(); // will show its children too

        Directory *tree = new Directory(disk.mount.toLocal8Bit());
        tree->append(free, disk.free);
        tree->append(used, disk.used);

        map->create(tree); //must be done when visible

        connect(map, SIGNAL(activated(const KUrl&)), SIGNAL(activated(const KUrl&)));
    }
}
Example #23
0
QgsWelcomePage::QgsWelcomePage( bool skipVersionCheck, QWidget *parent )
  : QWidget( parent )
{
  QgsSettings settings;

  QVBoxLayout *mainLayout = new QVBoxLayout;
  mainLayout->setMargin( 0 );
  mainLayout->setContentsMargins( 0, 0, 0, 0 );
  setLayout( mainLayout );

  QHBoxLayout *layout = new QHBoxLayout();
  layout->setMargin( 0 );

  mainLayout->addLayout( layout );

  QWidget *recentProjectsContainer = new QWidget;
  recentProjectsContainer->setLayout( new QVBoxLayout );
  recentProjectsContainer->layout()->setContentsMargins( 0, 0, 0, 0 );
  recentProjectsContainer->layout()->setMargin( 0 );

  int titleSize = QApplication::fontMetrics().height() * 1.4;
  QLabel *recentProjectsTitle = new QLabel( QStringLiteral( "<div style='font-size:%1px;font-weight:bold'>%2</div>" ).arg( titleSize ).arg( tr( "Recent Projects" ) ) );
  recentProjectsTitle->setContentsMargins( 10, 3, 0, 0 );

  recentProjectsContainer->layout()->addWidget( recentProjectsTitle );

  mRecentProjectsListView = new QListView();
  mRecentProjectsListView->setResizeMode( QListView::Adjust );
  mRecentProjectsListView->setContextMenuPolicy( Qt::CustomContextMenu );
  connect( mRecentProjectsListView, &QListView::customContextMenuRequested, this, &QgsWelcomePage::showContextMenuForProjects );

  mModel = new QgsWelcomePageItemsModel( mRecentProjectsListView );
  mRecentProjectsListView->setModel( mModel );
  mRecentProjectsListView->setItemDelegate( new QgsWelcomePageItemDelegate( mRecentProjectsListView ) );

  recentProjectsContainer->layout()->addWidget( mRecentProjectsListView );

  layout->addWidget( recentProjectsContainer );

  mVersionInformation = new QLabel;
  mainLayout->addWidget( mVersionInformation );
  mVersionInformation->setVisible( false );

  mVersionInfo = new QgsVersionInfo();
  if ( !QgsApplication::isRunningFromBuildDir() && settings.value( QStringLiteral( "qgis/checkVersion" ), true ).toBool() && !skipVersionCheck )
  {
    connect( mVersionInfo, &QgsVersionInfo::versionInfoAvailable, this, &QgsWelcomePage::versionInfoReceived );
    mVersionInfo->checkVersion();
  }

  connect( mRecentProjectsListView, &QAbstractItemView::activated, this, &QgsWelcomePage::itemActivated );
}
Example #24
0
/**
*  SOUTH Panel
*/
/*public*/ void IconItemPanel::makeBottomPanel(ActionListener* doneAction) {
 QWidget* bottomPanel = new QWidget();
 bottomPanel->setLayout(new FlowLayout());

 _catalogButton = new QPushButton(tr("Show Catalog"));
// _catalogButton.addActionListener(new ActionListener() {
//     @Override
//     public void actionPerformed(ActionEvent a) {
//         if (_catalog.isVisible()) {
//             hideCatalog();
//         } else {
//             showCatalog();
//         }
//     }
// });
 _catalogButton->setToolTip(tr("Open the Icon Catalog and drag icons from there to the Panel"));
 bottomPanel->layout()->addWidget(_catalogButton);

 if (doneAction == nullptr) {
     QPushButton* renameButton = new QPushButton(tr("Rename Icon"));
//     renameButton.addActionListener(new ActionListener() {
//         @Override
//         public void actionPerformed(ActionEvent a) {
//             renameIcon();
//         }
//     });
     connect(renameButton, SIGNAL(clicked(bool)), this, SLOT(renameIcon()));
     bottomPanel->layout()->addWidget(renameButton);

     QPushButton* addIconButton = new QPushButton(tr("Add Icon"));
//     addIconButton.addActionListener(new ActionListener() {
//         @Override
//         public void actionPerformed(ActionEvent a) {
//             addNewIcon();
//         }
//     });
     connect(addIconButton, SIGNAL(clicked(bool)), this, SLOT(addNewIcon()));
     addIconButton->setToolTip(tr("Add another icon to your Icon Set. Enter a name for it."));
     bottomPanel->layout()->addWidget(addIconButton);

     _deleteIconButton = new QPushButton(tr("Delete Icon"));
     //     _deleteIconButton.addActionListener(new ActionListener() {
     //         @Override
     //         public void actionPerformed(ActionEvent a) {
     //             deleteIcon();
     //         }
     //     });
     connect(_deleteIconButton, SIGNAL(clicked(bool)), this, SLOT(deleteIcon()));
     _deleteIconButton->setToolTip(tr("Delete an icon from your Icon Set. Select the icon to be deleted."));
     bottomPanel->layout()->addWidget(_deleteIconButton);
     _deleteIconButton->setEnabled(false);
 } else {
Example #25
0
/**
 * @brief MainWindow::addPerson fügt eine Person in die Datenbank und ins UI ein
 * @param pName Name der Person
 * @param pID ID der Person, falls verfügbar (wenn leer, dann wird eine eigene erstellt)
 * @return ID der Person
 */
int MainWindow::addPerson(QString pName, int pID){
    QString pEntry;
    Person *person = new Person(pName);
    /// Person in Liste erfassen (Fehler, falls ID bereits existiert)
    if (pID == -1){
        lendlib->addPersonToList(person);
    } else {
        if (!lendlib->addPersonToList(person, pID)){
            otherErr = true;
            errString = "Person konnte nicht mit vorgegebener ID eingegeben werden.";
            checkError();
        }
    }

    pEntry = QString::number(person->getID());

    /// UI-Elemente erstellen
    QWidget *newPerson = new QWidget;
    QHBoxLayout *newPersonLayout = new QHBoxLayout(newPerson);
    QPushButton *delB = new QPushButton("Löschen");
    QLabel *name = new QLabel(pName);
    QWidget *lent = new QWidget;
    new QVBoxLayout(lent);

    /// UI-Eigenschaften anpassen
    newPerson->setObjectName(pEntry);   // alle Medien-Widgets haben die Bezeichnung der ID
    delB->setObjectName("del"+pEntry);
    delB->setToolTip("Lösche Person "+pEntry+": "+pName);
    name->setObjectName("name"+pEntry);
    lent->setObjectName("lent"+pEntry);

    newPerson->layout()->setMargin(0);
    newPerson->setStyleSheet("border-bottom: 1px solid #DEE2CF");
    lent->layout()->setMargin(0);
    delB->setStyleSheet("background: #DEE2CF;");
    delB->setMinimumWidth(60);
    delB->setMaximumWidth(60);
    delB->setMinimumHeight(25);
    delB->setMaximumHeight(25);
    connect(delB, SIGNAL (released()), this, SLOT (deletePersonButton()));
    lent->setMaximumWidth(250);

    newPersonLayout->addWidget(delB);
    newPersonLayout->addWidget(name);
    newPersonLayout->addWidget(lent);
    qobject_cast<QVBoxLayout*>(ui->allPersonsScroll->layout())->insertWidget(getInsertPosition(pName,false),newPerson);

    ui->allPersonsScroll->layout()->removeItem(ui->personSpacer);
    ui->allPersonsScroll->layout()->addItem(ui->personSpacer);
    return person->getID();
}
Example #26
0
void TestBox::initStretchWidget() {
    QWidget* cont = new QWidget();
    cont->setLayout(new QVBoxLayout());
    cont->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);

    for (int i=0; i<=5; ++i) {
        stretch->addItem(QString("%1").arg(i), i);
    }
    cont->layout()->addWidget(new QLabel("Stretch (QBoxLayout only)"));
    cont->layout()->addWidget(stretch);
    layout()->addWidget(cont);

    connect(stretch, SIGNAL(activated(int)), this, SLOT(stretchRequested(int)));
}
Example #27
0
LifeFormWidget::LifeFormWidget(QWidget *parent) :
    QWidget(parent)
{
    QVBoxLayout * layout = new QVBoxLayout;
    QGroupBox * groupBox = new QGroupBox;
    mAgeSpinBox = new QSpinBox;
    mNameEdit = new QLineEdit;
    mXSpinBox = new QSpinBox;
    mYSpinBox = new QSpinBox;

    setWindowIcon(QIcon(":rabbit"));
    groupBox->setTitle("Properties");

    mNameEdit->setPlaceholderText("Name");
    mAgeSpinBox->setPrefix("age: ");
    mXSpinBox->setPrefix("x: ");
    mYSpinBox->setPrefix("y: ");

    mGenomView = new GenomView;
    QWidget * coordWidget = new QWidget;
    coordWidget->setLayout(new QHBoxLayout);
    coordWidget->layout()->setMargin(0);
    coordWidget->layout()->addWidget(mXSpinBox);
    coordWidget->layout()->addWidget(mYSpinBox);

    layout->addWidget( mNameEdit);
    layout->addWidget( mAgeSpinBox);
    layout->addWidget( coordWidget);

    groupBox->setLayout(layout);
    groupBox->layout()->setContentsMargins(0,10,0,0);

    QGroupBox * genomGroupBox = new QGroupBox;
    genomGroupBox->setTitle("Genom");
    genomGroupBox->setLayout(new QVBoxLayout);
    genomGroupBox->layout()->addWidget(mGenomView);
    genomGroupBox->layout()->setMargin(0);


    QVBoxLayout * mainLayout = new QVBoxLayout;
    mainLayout->setSpacing(10);
    mainLayout->addWidget(groupBox);
    mainLayout->addWidget(genomGroupBox);
    mainLayout->setContentsMargins(0,0,0,0);

    setLayout(mainLayout);


}
/*protected*/ QWidget* ReporterItemPanel::instructions() {
    QWidget* blurb = new QWidget();
    QVBoxLayout* layout;
    blurb->setLayout(layout = new QVBoxLayout(blurb/*, BoxLayout.Y_AXIS*/));
    //blurb.add(Box.createVerticalStrut(ItemPalette.STRUT_SIZE));
    layout->addStrut(ItemPalette::STRUT_SIZE);
    blurb->layout()->addWidget(new JLabel(tr("To Add an Icon to your control panel:")));
    blurb->layout()->addWidget(new JLabel(tr("--drag an icon from the display panel below to your control panel")));
    //blurb.add(Box.createVerticalStrut(ItemPalette.STRUT_SIZE));
    layout->addStrut(ItemPalette::STRUT_SIZE);
    QWidget*  panel = new QWidget();
    panel->setLayout(new FlowLayout);
    panel->layout()->addWidget(blurb);
    return panel;
}
Example #29
0
void DetailsWidget::fixUpLayout()
{
    if (!m_widget)
        return;
    QWidget *parent = m_widget;
    QStack<QWidget *> widgets;
    while((parent = parent->parentWidget()) && parent && parent->layout()) {
        widgets.push(parent);
        parent->layout()->update();
    }

    while(!widgets.isEmpty()) {
        widgets.pop()->layout()->activate();
    }
}
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    QWidget *centralWidget = new QWidget;
    centralWidget->setLayout(new QVBoxLayout);
    centralWidget->layout()->setMargin(0);
    centralWidget->layout()->setSpacing(0);
    setCentralWidget(centralWidget);

    ActionBar *tabBar = new ActionBar(QIcon(":/icons/logo"));
    centralWidget->layout()->addWidget(tabBar);

    QAction *proj = new QAction(QIcon(":/icons/project"), "project", this);
    connect(proj, SIGNAL(triggered()), this, SLOT(toProjMgPage()));
    tabBar->addButton(proj, 2, true);

    QAction *mem = new QAction(QIcon(":/icons/member"), "member", this);
    connect(mem, SIGNAL(triggered()), this, SLOT(toMemMgPage()));
    tabBar->addButton(mem, 3, true);

    QMdiArea *mdiArea = new QMdiArea;
    centralWidget->layout()->addWidget(mdiArea);

    mem_mg = new MemMgWindow(mdiArea);
    mem_mg->setAttribute(Qt::WA_DeleteOnClose);
    mem_mg->setWindowFlags (Qt::SubWindow | Qt::FramelessWindowHint);
    mem_mg->hide();
    connect(mem_mg, SIGNAL(turnToContentWindow(int)), this, SLOT(toMemContentPage(int)));

    mem_content = new MemContentWindow(mdiArea);
    mem_content->setAttribute(Qt::WA_DeleteOnClose);
    mem_content->setWindowFlags (Qt::SubWindow | Qt::FramelessWindowHint);
    mem_content->hide();
    connect(mem_content, SIGNAL(turnToInfoWindow(int ,QSqlQuery&)), this, SLOT(toMemInfoPage(int ,QSqlQuery&)));
    connect(mem_content, SIGNAL(back()), this, SLOT(toMemMgPage()));

    mem_info = new MemInfoWindow(mdiArea);
    mem_info->setAttribute(Qt::WA_DeleteOnClose);
    mem_info->setWindowFlags (Qt::SubWindow | Qt::FramelessWindowHint);
    mem_info->hide();
    connect(mem_info, SIGNAL(back(int)), this, SLOT(toMemContentPage(int)));

    proj_mg = new ProjMgWindow(mdiArea);
    proj_mg->setAttribute(Qt::WA_DeleteOnClose);
    proj_mg->setWindowFlags (Qt::SubWindow | Qt::FramelessWindowHint);
    proj_mg->hide();

    toProjMgPage();
}