void AnnotationImagePaletteWidget::addPalette(const QString& path)
{
   QListView* pPalette = new QListView(this);
   pPalette->setWrapping(true);
   pPalette->setLayoutMode(QListView::Batched);
   pPalette->setBatchSize(10);
   pPalette->setMovement(QListView::Static);
   pPalette->setFlow(QListView::LeftToRight);
   pPalette->setIconSize(QSize(32, 32));
   pPalette->setViewMode(QListView::IconMode);
   pPalette->setDragEnabled(true);
   pPalette->setDragDropMode(QAbstractItemView::DragOnly);
   pPalette->setSelectionMode(QAbstractItemView::SingleSelection);
   pPalette->setResizeMode(QListView::Adjust);

   if (QFileInfo(path).isDir())
   {
      QDirModel* pModel = new PaletteModel(this);
      pModel->setFilter(QDir::Files | QDir::Readable);
      QStringList formats;
      QList<QByteArray> rawFormats = QImageReader::supportedImageFormats();
      foreach (const QByteArray& rawFormat, rawFormats)
      {
         formats << "*." + QString(rawFormat);
      }
Example #2
0
QgsWelcomePage::QgsWelcomePage( bool skipVersionCheck, QWidget* parent )
    : QWidget( parent )
{
  QSettings settings;

  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 );
  recentProjctsContainer->layout()->setContentsMargins( 3, 3, 3, 0 );
  QLabel* recentProjectsTitle = new QLabel( QString( "<h1>%1</h1>" ).arg( tr( "Recent Projects" ) ) );
  recentProjctsContainer->layout()->addWidget( recentProjectsTitle );

  QListView* recentProjectsListView = new QListView();
  recentProjectsListView->setResizeMode( QListView::Adjust );

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

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

  layout->addWidget( recentProjctsContainer );

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

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

  connect( recentProjectsListView, SIGNAL( activated( QModelIndex ) ), this, SLOT( itemActivated( QModelIndex ) ) );
}
Example #3
0
LogBrowser::LogBrowser(QWidget *parent)
  : QWidget(parent)
  , m_nextID(0)
  , m_actorFilterActive(false)
  , m_actorFilterCheck(0)
{
    m_log = new LogModel(this);
    m_log->setResultType(Log::MostRecentSubjects);

    QSortFilterProxyModel *filter = new QSortFilterProxyModel(this);
    filter->setSourceModel(m_log);
    filter->setSortCaseSensitivity(Qt::CaseInsensitive);
    filter->setDynamicSortFilter(true);
    filter->setFilterKeyColumn(0);

    QLineEdit *searchBox = new QLineEdit(this);
    searchBox->setPlaceholderText(tr("Search"));
    connect(searchBox, SIGNAL(textEdited(QString)), filter, SLOT(setFilterFixedString(QString)));


    QListView *view = new QListView(this);
    view->setResizeMode(QListView::Adjust);
    connect(view, SIGNAL(activated(QModelIndex)), this, SLOT(handleActivation(QModelIndex)));

    m_logView = view;
    m_logView->setModel(filter);


    QVBoxLayout *layout = new QVBoxLayout(this);
    m_filterLayout = new QHBoxLayout(this);
    layout->addWidget(searchBox);
    layout->addLayout(m_filterLayout);
    layout->addWidget(m_logView);

    m_actionMapper = new QSignalMapper(this);
    connect(m_actionMapper, SIGNAL(mapped(int)), this, SLOT(applyFilter(int)));

    DataModel::Event emptyEvent;
    addEventFilter(DataModel::EventList() << emptyEvent, "All")->setChecked(true);
}