Example #1
0
NotesItemView::NotesItemView(Notes *notes, QTreeView *treeView) :  m_treeView(treeView), m_notes(notes)
{
    m_itemModel = new QStandardItemModel(m_treeView);
    m_itemModel->setHeaderData(0, Qt::Horizontal, tr("Note Title"));
    connect(m_treeView, SIGNAL(activated(QModelIndex)), this, SLOT(showNote(QModelIndex)));
    connect(m_treeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(notesContextMenu(QPoint)));

    m_proxyModel = new RecursivProxyModel(this);
    m_proxyModel->setSourceModel(m_itemModel);
    m_proxyModel->setHeaderData(0, Qt::Horizontal, tr("Note Title"));

    m_selectionModel = new QItemSelectionModel(m_proxyModel);

    m_treeView->setSortingEnabled(true);
    m_treeView->setModel(m_proxyModel);
    m_treeView->setSelectionModel(m_selectionModel);

    m_itemModel->clear();

    QStyle *style = QApplication::style();

    m_folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirClosedIcon), QIcon::Normal, QIcon::Off);
    m_folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirOpenIcon), QIcon::Normal, QIcon::On);

}
Example #2
0
//=========================================================================
hTreeBrowser::hTreeBrowser(QWidget *parent, MainWindow * mainWindow)
    : QTreeWidget   (parent)
    , parent_       (parent->parentWidget())
    , theMainWindow_(mainWindow)
    , currentCanvas_(0)
    , canvasPosX_   (5)
    , canvasPosY_   (5)
    , canvasWitdh_  (800)
    , canvasHeight_ (600)
    , currentObject_(0)
{
    //    theHManager_   = theMainWindow_->getHManager()   ;
    serviceCanvas_.clear();
    cSw_.clear() ;

    QStringList labels;
    labels << tr("Folder Name") << tr("Object Type") << tr("Entries");
    this->setHeaderLabels(labels);
    this->header()->setResizeMode(0, QHeaderView::Interactive);
    this->header()->setResizeMode(1, QHeaderView::Interactive);
    this->header()->setResizeMode(2, QHeaderView::Interactive);

    this->header()->setDefaultSectionSize(200);

    this->setContextMenuPolicy(Qt::CustomContextMenu);

    QStyle *style = parent_->style();

    QString imagesDir = QString(getenv("CHEWIEDIR")) + "/images/";
    QPixmap closedFolderPM(imagesDir+"ClosedFolder.png");
    QPixmap openFolderPM  (imagesDir+"OpenFolder.png"  );
    QPixmap TH1IconPM     (imagesDir+"TH1Icon.png"     );
    QPixmap TH2IconPM     (imagesDir+"TH2Icon.png"     );
    QPixmap TTreePM       (imagesDir+"TreeIcon.png"    );
    QPixmap TGraphPM      (imagesDir+"TGraphIcon.png"  );
    QPixmap TProfilePM    (imagesDir+"TProfileIcon.png");

    folderIcon_  .addPixmap(closedFolderPM, QIcon::Normal, QIcon::Off      );
    folderIcon_  .addPixmap(openFolderPM,   QIcon::Normal, QIcon::On       );
    canvasIcon_  .addPixmap(style->standardPixmap(QStyle::SP_FileIcon     ));
    TH1Icon_     .addPixmap(TH1IconPM                                      );
    TH2Icon_     .addPixmap(TH2IconPM                                      );
    tTreeIcon_   .addPixmap(TTreePM                                        );
    tGraphIcon_  .addPixmap(TGraphPM                                       );
    tProfileIcon_.addPixmap(TProfilePM                                     );
    mainIcon_    .addPixmap(style->standardPixmap(QStyle::SP_DriveHDIcon  ));

    this->setAnimated(true);

    this->setSelectionMode(QAbstractItemView::ExtendedSelection);

    QObject::connect(this, SIGNAL(customContextMenuRequested( const QPoint         &     )),
                     this, SLOT(  showContextMenu           ( const QPoint         &     ))) ;
    QObject::connect(this, SIGNAL(itemClicked               (       QTreeWidgetItem*, int)),
                     this, SLOT(  manipulateFolder          (       QTreeWidgetItem*, int))) ;
    //QObject::connect(this, SIGNAL(itemEntered               (       QTreeWidgetItem*, int)),
    //                 this, SLOT(  showHint                  (       QTreeWidgetItem*, int))) ;
}
    XMLParameterReader::XMLParameterReader(QTreeWidget *tree_widget)
                      : tree_widget(tree_widget)
    {
      QStyle * style = tree_widget->style();

      subsection_icon.addPixmap(style->standardPixmap(QStyle::SP_DirClosedIcon), QIcon::Normal, QIcon::Off);
      subsection_icon.addPixmap(style->standardPixmap(QStyle::SP_DirOpenIcon), QIcon::Normal, QIcon::On);

      parameter_icon.addPixmap(style->standardPixmap(QStyle::SP_FileIcon));
    }
Example #4
0
//! [0]
XbelReader::XbelReader(QTreeWidget *treeWidget)
    : treeWidget(treeWidget)
{
    QStyle *style = treeWidget->style();

    folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirClosedIcon),
                         QIcon::Normal, QIcon::Off);
    folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirOpenIcon),
                         QIcon::Normal, QIcon::On);
    bookmarkIcon.addPixmap(style->standardPixmap(QStyle::SP_FileIcon));
}
Example #5
0
XbelHandler::XbelHandler(QTreeWidget *treeWidget)
    : treeWidget(treeWidget)
{
    item = 0;
    metXbelTag = false;

    QStyle *style = treeWidget->style();

    folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirClosedIcon),
                         QIcon::Normal, QIcon::Off);
    folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirOpenIcon),
                         QIcon::Normal, QIcon::On);
    bookmarkIcon.addPixmap(style->standardPixmap(QStyle::SP_FileIcon));
}
Example #6
0
QIcon QgsDataCollectionItem::iconDir()
{
  static QIcon sIcon;

  if ( sIcon.isNull() )
  {
    // initialize shared icons
    QStyle *style = QApplication::style();
    sIcon = QIcon( style->standardPixmap( QStyle::SP_DirClosedIcon ) );
    sIcon.addPixmap( style->standardPixmap( QStyle::SP_DirOpenIcon ),
                     QIcon::Normal, QIcon::On );
  }

  return sIcon;
}
Example #7
0
void QgsBrowserModel::addRootItems()
{
  updateProjectHome();

  // give the home directory a prominent second place
  QgsDirectoryItem *item = new QgsDirectoryItem( NULL, tr( "Home" ), QDir::homePath(), "home:" + QDir::homePath() );
  QStyle *style = QApplication::style();
  QIcon homeIcon( style->standardPixmap( QStyle::SP_DirHomeIcon ) );
  item->setIcon( homeIcon );
  connectItem( item );
  mRootItems << item;

  // add favourite directories
  mFavourites = new QgsFavouritesItem( NULL, tr( "Favourites" ) );
  if ( mFavourites )
  {
    connectItem( mFavourites );
    mRootItems << mFavourites;
  }

  // add drives
  foreach ( QFileInfo drive, QDir::drives() )
  {
    QString path = drive.absolutePath();
    QgsDirectoryItem *item = new QgsDirectoryItem( NULL, path, path );

    connectItem( item );
    mRootItems << item;
  }
QgsBrowserModel::QgsBrowserModel( QObject *parent ) :
    QAbstractItemModel( parent )
{
  QStyle *style = QApplication::style();
  mIconDirectory = QIcon( style->standardPixmap( QStyle::SP_DirClosedIcon ) );
  mIconDirectory.addPixmap( style->standardPixmap( QStyle::SP_DirOpenIcon ),
                            QIcon::Normal, QIcon::On );

  foreach( QFileInfo drive, QDir::drives() )
  {
    QString path = drive.absolutePath();
    QgsDirectoryItem *item = new QgsDirectoryItem( NULL, path, path );

    connectItem( item );
    mRootItems << item;
  }
Example #9
0
void QgsBrowserModel::addRootItems()
{
  updateProjectHome();

  // give the home directory a prominent third place
  QgsDirectoryItem *item = new QgsDirectoryItem( nullptr, tr( "Home" ), QDir::homePath(), QStringLiteral( HOME_PREFIX ) + QDir::homePath() );
  item->setSortKey( QStringLiteral( " 2" ) );
  QStyle *style = QApplication::style();
  QIcon homeIcon( style->standardPixmap( QStyle::SP_DirHomeIcon ) );
  item->setIcon( homeIcon );
  connectItem( item );
  mRootItems << item;

  // add favorite directories
  mFavorites = new QgsFavoritesItem( nullptr, tr( "Favorites" ) );
  if ( mFavorites )
  {
    connectItem( mFavorites );
    mRootItems << mFavorites;
  }

  // add drives
  Q_FOREACH ( const QFileInfo &drive, QDir::drives() )
  {
    QString path = drive.absolutePath();

    if ( QgsDirectoryItem::hiddenPath( path ) )
      continue;

    QgsDirectoryItem *item = new QgsDirectoryItem( nullptr, path, path );
    item->setSortKey( QStringLiteral( " 3 %1" ).arg( path ) );

    connectItem( item );
    mRootItems << item;
  }
Example #10
0
void MainWindow::create_actions()
{
    QStyle * style = tree_widget->style();

    open_act = new QAction(tr("&Open..."), this);				// create actions
    open_act->setIcon(style->standardPixmap(QStyle::SP_DialogOpenButton));    // and set icons
    open_act->setShortcut(Qt::CTRL + Qt::Key_O);				// set a short cut
    open_act->setStatusTip(tr("Open a XML file"));				// set a status tip
    connect(open_act, SIGNAL(triggered()), this, SLOT(open()));		// and connect

    save_act = new QAction(tr("&Save ..."), this);
    save_act->setIcon(style->standardPixmap(QStyle::SP_DialogSaveButton));
    save_act->setShortcut(Qt::CTRL + Qt::Key_S);
    save_act->setStatusTip(tr("Save the current XML file"));
    connect(save_act, SIGNAL(triggered()), this, SLOT(save()));

    save_as_act = new QAction(tr("&Save As..."), this);
    save_as_act->setIcon(style->standardPixmap(QStyle::SP_DialogSaveButton));
    save_as_act->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Q);
    save_as_act->setStatusTip(tr("Save the current XML file as"));
    connect(save_as_act, SIGNAL(triggered()), this, SLOT(save_as()));

    exit_act = new QAction(tr("E&xit"), this);
    exit_act->setIcon(style->standardPixmap(QStyle::SP_DialogCloseButton));
    exit_act->setShortcut(Qt::CTRL + Qt::Key_Q);
    exit_act->setStatusTip(tr("Exit the parameterGUI application"));
    connect(exit_act, SIGNAL(triggered()), this, SLOT(close()));

    about_act = new QAction(tr("&About"), this);
    about_act->setIcon(style->standardPixmap(QStyle::SP_FileDialogInfoView));
    about_act->setStatusTip(tr("Show the parameterGUI About box"));
    connect(about_act, SIGNAL(triggered()), this, SLOT(about()));

    about_qt_act = new QAction(tr("About &Qt"), this);
    about_qt_act->setStatusTip(tr("Show the Qt library's About box"));
    connect(about_qt_act, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
Example #11
0
void QgsBrowserModel::addRootItems()
{
  // give the home directory a prominent first place
  QgsDirectoryItem *item = new QgsDirectoryItem( NULL, tr( "Home" ), QDir::homePath() );
  QStyle *style = QApplication::style();
  QIcon homeIcon( style->standardPixmap( QStyle::SP_DirHomeIcon ) );
  item->setIcon( homeIcon );
  connectItem( item );
  mRootItems << item;

  // add favourite directories
  QSettings settings;
  QStringList favDirs = settings.value( "/browser/favourites", QVariant() ).toStringList();
  foreach( QString favDir, favDirs )
  {
    QgsDirectoryItem *item = new QgsDirectoryItem( NULL, favDir, favDir );
    connectItem( item );
    mRootItems << item;
  }