void MetaListViewWidget::setActivationClickMode(ActivationClickMode mode)
{
    bool singleClickEnabled = false;
    switch (mode) {
        case UseKdeDefault:
            singleClickEnabled = KGlobalSettings::singleClick();
            break;
        case SingleClick:
            singleClickEnabled = true;
            break;
        case DoubleClick:
            singleClickEnabled = false;
            break;
    }

    m_activationClickMode = mode;
    disconnect(m_listView, 0, this, SIGNAL(itemActivated(QModelIndex)) );

    if ( singleClickEnabled ) {
        //FIXME clicked() is emited even when we are selecting multiple items with ctrl+click
        connect(m_listView, SIGNAL(clicked(QModelIndex)), SIGNAL(itemActivated(QModelIndex)) );
        m_listView->setMouseTracking(true);
        connect(m_listView, SIGNAL(entered(QModelIndex)), SLOT(slotItemHovered(QModelIndex)) );
    } else {
        connect(m_listView, SIGNAL(doubleClicked(QModelIndex)), SIGNAL(itemActivated(QModelIndex)) );
        m_listView->setMouseTracking(false);
        disconnect(m_listView, SIGNAL(entered(QModelIndex)), this, SLOT(slotItemHovered(QModelIndex)) );
    }
}
Exemple #2
0
    void ListTable::createNewRow()
    {

      QListWidgetItem * item = 0;
      switch (type_)
      {
      case ListEditor::INT:
        item = new QListWidgetItem("0");
        break;

      case ListEditor::FLOAT:
        item = new QListWidgetItem("0.0");
        break;

      default:
        item = new QListWidgetItem("");
      }
      item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
      addItem(item);
      setItemSelected(item, true);
      setCurrentRow(row(item));
      itemActivated(item);
      edit(currentIndex());
    }
MainWindow::MainWindow()
{
	QAction *exitAct = new QAction(tr("E&xit"), this);
	exitAct->setShortcuts(QKeySequence::Quit);
	connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

	QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
	fileMenu->addSeparator();
	fileMenu->addAction(exitAct);

	columnsMenu = menuBar()->addMenu(tr("&Columns"));
	connect(columnsMenu, SIGNAL(aboutToShow()), this, SLOT(showColumnsMenu()));

	model = new PeerDrive::FolderModel(this);
	connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this,
		SLOT(modelRowsInserted(QModelIndex,int,int)));
	connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this,
		SLOT(modelDataChanged(QModelIndex,QModelIndex)));
	connect(model, SIGNAL(modelReset()), this, SLOT(modelReset()));

	treeView = new QTreeView;
	treeView->setModel(model);
	treeView->sortByColumn(0, Qt::AscendingOrder);
	treeView->setSortingEnabled(true);
	connect(treeView, SIGNAL(activated(QModelIndex)), this,
		SLOT(itemActivated(QModelIndex)));

	setCentralWidget(treeView);
	setWindowTitle(QObject::tr("Simple Tree Model"));
	setUnifiedTitleAndToolBarOnMac(true);
}
/*!
    Handles the given gesture event.

    \param event The event to handle.
*/
void NmAttachmentListItem::gestureEvent(QGestureEvent *event)
{
    NM_FUNCTION;
    
    if (HbTapGesture *tap = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) {
        switch (tap->tapStyleHint()) {
            case HbTapGesture::Tap: {
                Qt::GestureState state = tap->state();
                HbInstantFeedback::play(HbFeedback::Basic);
                setPressed(true);

                if (state == Qt::GestureFinished) {
                    emit itemActivated();
                    setPressed(false);
                }
                else if (state == Qt::GestureCanceled) {
                    setPressed(false);
                }

                break;
            }
            case HbTapGesture::TapAndHold: {
                emit itemLongPressed(event->mapToGraphicsScene(tap->position()));
                setPressed(false);    
                break;
            }
        } // switch
    }
    else {
        // Let the HbWidget handle the event.
        HbWidget::gestureEvent(event);
    }
}
KShortcutsEditorDelegate::KShortcutsEditorDelegate(QTreeWidget *parent, bool allowLetterShortcuts)
    : KExtendableItemDelegate(parent),
      m_allowLetterShortcuts(allowLetterShortcuts),
      m_editor(0)
{
    Q_ASSERT(qobject_cast<QAbstractItemView *>(parent));

    QPixmap pixmap(16, 16);
    pixmap.fill(QColor(Qt::transparent));
    QPainter p(&pixmap);
    QStyleOption option;
    option.rect = pixmap.rect();

    bool isRtl = QApplication::isRightToLeft();
    QApplication::style()->drawPrimitive(isRtl ? QStyle::PE_IndicatorArrowLeft : QStyle::PE_IndicatorArrowRight, &option, &p);
    p.end();
    setExtendPixmap(pixmap);

    pixmap.fill(QColor(Qt::transparent));
    p.begin(&pixmap);
    QApplication::style()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &option, &p);
    p.end();
    setContractPixmap(pixmap);

    parent->installEventFilter(this);

    // Listen to activation signals
    // connect(parent, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex)));
    connect(parent, SIGNAL(clicked(QModelIndex)), this, SLOT(itemActivated(QModelIndex)));

    // Listen to collapse signals
    connect(parent, SIGNAL(collapsed(QModelIndex)), this, SLOT(itemCollapsed(QModelIndex)));
}
MainWidget::MainWidget( MainWindow* parent )
    : QWidget( parent ), mMainWindow( parent )
{
    // Layout
    QHBoxLayout *layout = new QHBoxLayout( this );
    QSplitter *topSplitter = new QSplitter( Qt::Vertical, this );
    layout->addWidget( topSplitter );
    QSplitter *splitter = new QSplitter( Qt::Horizontal,  this );
    topSplitter->addWidget( splitter );

    /*
     * Views
     */
    // Calendar listview
    mCollectionList = new Akonadi::CollectionView();
    splitter->addWidget( mCollectionList );

    // Event listview
    mIncidenceList = new QTreeView( this );
    mIncidenceList->setDragEnabled( this );
    mIncidenceList->setRootIsDecorated( false );
    splitter->addWidget( mIncidenceList );

    // Event view
    mIncidenceViewer = new CalendarSupport::IncidenceViewer( this );
    topSplitter->addWidget( mIncidenceViewer );


    /*
     * Models
     */
    // Calendar model
    mCollectionModel = new Akonadi::CollectionModel( this );
    mCollectionProxyModel = new Akonadi::CollectionFilterProxyModel( this );
    mCollectionProxyModel->setSourceModel( mCollectionModel );
    mCollectionProxyModel->addMimeTypeFilter( QString::fromLatin1( "text/calendar" ) );

    // display collections sorted
    QSortFilterProxyModel *sortModel = new QSortFilterProxyModel( this );
    sortModel->setDynamicSortFilter( true );
    sortModel->setSortCaseSensitivity( Qt::CaseInsensitive );
    sortModel->setSourceModel( mCollectionProxyModel );

    // Calendar view (list of incidences)
    mIncidenceModel = new CalendarSupport::KCalModel( this );

    /*
     * Connexion between views and models
     */
    mIncidenceList->setModel( mIncidenceModel );
    mCollectionList->setModel( sortModel );

    /*
     * React to user orders
     */
    connect( mCollectionList, SIGNAL(clicked(Akonadi::Collection)),
             SLOT(collectionClicked(Akonadi::Collection)) );
    connect( mIncidenceList, SIGNAL(clicked(QModelIndex)), SLOT(itemActivated(QModelIndex)) );
}
void FindSubtitlesWindow::download()
{
    qDebug("FindSubtitlesWindow::download");

    if (view->currentIndex().isValid()) {
        itemActivated(view->currentIndex());
    }
}
void SettingsList::selectFirst(){
  QListWidgetItem* list_item;
  list_item = item(0);
  if (list_item){
    setCurrentRow(0);
  }
  emit(itemActivated(list_item));
}
Exemple #9
0
void ListView::gotoIssue( int issueId, int itemId )
{
    if ( issueId != m_selectedIssueId )
        setSelectedIssueId( issueId );

    if ( issueId == m_selectedIssueId )
        emit itemActivated( itemId );
}
Exemple #10
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 ) ) );
}
Exemple #11
0
void ComboBox::onItemActivated(int index)
{
    if (index == count()-1) {
        setCurrentIndex(0);
        emit addItemActivated();
    }
    else {
        emit itemActivated(index);
    }
}
Exemple #12
0
void QompPluginTreeView::mouseDoubleClickEvent(QMouseEvent *e)
{
	QModelIndex i = indexAt(e->pos());
	if(i.isValid()) {
		setCurrentIndex(i);
		itemActivated();
		return;
	}
	return QTreeView::mouseDoubleClickEvent(e);
}
Exemple #13
0
void QompPluginTreeView::keyPressEvent(QKeyEvent *ke)
{
	if(ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Space) {
		itemActivated();
		ke->accept();
		return;
	}

	QTreeView::keyPressEvent(ke);
}
Exemple #14
0
void RDTreeWidget::mouseReleaseEvent(QMouseEvent *e)
{
  QModelIndex idx = indexAt(e->pos());

  if(idx.isValid() && idx.column() == m_hoverColumn && m_activateOnClick)
  {
    emit itemActivated(itemAt(e->pos()), idx.column());
  }

  QTreeWidget::mouseReleaseEvent(e);
}
Exemple #15
0
void TrayIcon::init()
{
    if (debug) qDebug() << PDEBUG;

    setIcon(QIcon(":icon"));
    setToolTip(QString("netctl-gui"));

    createActions();

    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(itemActivated(QSystemTrayIcon::ActivationReason)));
}
Exemple #16
0
void ConfirmWidget::keyPressEvent(QKeyEvent *ev)
{
    if(ev->key() == Qt::Key_Return || ev->key() == Qt::Key_Enter)
    {
        QPoint p = m_list->mapFromGlobal(QCursor::pos());
        QListWidgetItem *it = m_list->itemAt(p);
        if(it)
            itemActivated(it);
        deleteLater();
    }
    else if(ev->key() == Qt::Key_Escape)
        deleteLater();
}
Exemple #17
0
 FeedListView::FeedListView(FeedList* feeds, QWidget* parent)
     : QListView(parent), feeds(feeds)
 {
     setContextMenuPolicy(Qt::CustomContextMenu);
     setSelectionMode(QAbstractItemView::ExtendedSelection);
     setModel(feeds);
     setItemDelegate(new FeedListDelegate(this));
     setAlternatingRowColors(true);
     setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::EditKeyPressed);
     connect(this, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(itemActivated(const QModelIndex&)));
     connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(itemActivated(QModelIndex)));
     connect(this->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
             this, SLOT(selectionChanged(const QItemSelection&, const QItemSelection&)));
 }
Exemple #18
0
int Helper::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: closed(); break;
        case 1: updateView(); break;
        case 2: itemActivated((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 3;
    }
    return _id;
}
Exemple #19
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: fetch(); break;
        case 1: itemActivated((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break;
        case 2: readData((*reinterpret_cast< const QHttpResponseHeader(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 3;
    }
    return _id;
}
void ItemLibraryTreeView::activateItem( const QModelIndex & /*index*/)
{
    QMimeData *mimeData = model()->mimeData(selectedIndexes());
    if (!mimeData)
        return;

    QString name;
    QFileSystemModel *fileSystemModel = qobject_cast<QFileSystemModel*>(model());
    Q_ASSERT(fileSystemModel);
    QFileInfo fileInfo = fileSystemModel->fileInfo(selectedIndexes().front());
    QPixmap pixmap(fileInfo.absoluteFilePath());
    if (!pixmap.isNull()) {
        name = "image^" + fileInfo.absoluteFilePath();
        emit itemActivated(name);
    }
}
int QSoapExplorer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: getWsdl(); break;
        case 1: parseWsdl(); break;
        case 2: buildOperationsList(); break;
        case 3: itemActivated((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Exemple #22
0
int History::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = HistoryView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0:
            historyChanged((*reinterpret_cast< const Quackle::History(*)>(_a[1])));
            break;
        case 1:
            itemActivated((*reinterpret_cast< QTableWidgetItem*(*)>(_a[1])));
            break;
        }
        _id -= 2;
    }
    return _id;
}
Exemple #23
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 ) ) );
}
Exemple #24
0
/*!
    \internal
*/
void UsbGadgetSelector::loadServices()
{
    foreach (const QString &service, QtopiaService::list()) {
        if (!service.startsWith("UsbGadget/"))
            continue;

        QSettings config(QtopiaService::config(service), QSettings::IniFormat);
        config.beginGroup("Service");
        const QString gadgetName = config.value("Gadget").toString();
        if (gadgetName.isEmpty())
            continue;

        QUsbGadget *gadget = new QUsbGadget(gadgetName);
        if (!gadget->available()) {
            delete gadget;
            continue;
        }
        delete gadget;

        foreach (const QString &app, QtopiaService::apps(service)) {
            QString appConfig = QtopiaService::appConfig(service, app);

            QTranslatableSettings config(appConfig, QSettings::IniFormat);

            config.beginGroup("Standard");

            QListWidgetItem *item = new QListWidgetItem(config.value("Name", app).toString());

            QString icon = config.value("Icon").toString();
            if (!icon.isEmpty())
                item->setIcon(QIcon(":icon/" + icon));

            item->setData(Qt::UserRole, service);
            item->setData(Qt::UserRole + 1, app);

            m_services->addItem(item);
            if (m_service == service &&
                m_application == app) {
                itemActivated(item);
                m_services->setCurrentItem(item);
            }
        }
    }
Exemple #25
0
MetaListViewPart::MetaListViewPart(QObject *parent)
    : KParts::Part(parent), m_proxyModel(NULL), m_defaultRow(-1)
{
    m_widget = new MetaListViewWidget;
    setWidget(m_widget);

    connect(m_widget, SIGNAL(itemActivated(QModelIndex)),
            SLOT(slotItemActivated(QModelIndex)) );
    connect(m_widget, SIGNAL(selectionChanged(QItemSelection)),
            SLOT(slotSelectionChanged(QItemSelection)) );
    connect(m_widget, SIGNAL(contextMenuRequested(QModelIndex)),
            SLOT(slotContextMenuRequested(QModelIndex)) );

    // Show initial information on the metaBar
    slotSelectionChanged(QItemSelection());

    //populate the listView (later, in order to respect the size of the listView)
    QMetaObject::invokeMethod(this, "loadModel", Qt::QueuedConnection);

    /* ACTIONS */
    KSelectAction *view_mode = new KSelectAction(i18n("View mode"), this);
    connect(view_mode, SIGNAL(triggered(int)), SLOT(changeViewMode(int)) );
    actionCollection()->addAction("view_mode", view_mode);
    actionCollection()->addAction("view_mode_list",
                view_mode->addAction(KIcon("view-list-details"), i18n("List")) );
    actionCollection()->addAction("view_mode_icons",
                view_mode->addAction(KIcon("view-list-icons"), i18n("Icons")) );

    KSelectAction *metabar_position = new KSelectAction(i18n("Metabar position"), this);
    connect(metabar_position, SIGNAL(triggered(int)), SLOT(changeMetaBarPosition(int)) );
    actionCollection()->addAction("metabar_position", metabar_position);

    QString str_left = i18nc("Opposite of right", "Left");
    QString str_right = i18nc("Opposite of left", "Right");
    if ( QApplication::isLeftToRight() ) {
        actionCollection()->addAction("metabar_position_left", metabar_position->addAction(str_left));
        actionCollection()->addAction("metabar_position_right", metabar_position->addAction(str_right));
    } else {
        actionCollection()->addAction("metabar_position_right", metabar_position->addAction(str_right));
        actionCollection()->addAction("metabar_position_left", metabar_position->addAction(str_left));
    }
    actionCollection()->addAction("metabar_position_hidden", metabar_position->addAction(i18n("Hidden")) );
}
Exemple #26
0
void ComboBox::onItemActivated(int index)
{
    if (index == count()-1) {
        setCurrentIndex(0);
        emit addItemActivated();
    }
    else {
        emit itemActivated(index);
    }

    /*if (! mDialog)
        return;

    if (index == count()-1) {
        mDialog->exec();
    }

    setCurrentIndex(0);
    */
}
void k9astTitles::CurrentItemChanged(QTreeWidgetItem *_new,QTreeWidgetItem *_old) {
    if (m_updating)
        return;
    _k9ItemWidget *previous,*current;
    previous=(_k9ItemWidget*)_old;
    current=(_k9ItemWidget*)_new;
    if (current) {
        if (current->type() ==TITLE) {
/*            for (int i=0;i <m_src->topLevelItemCount();i++) {
                _k9ItemWidget *item=(_k9ItemWidget*) m_src->topLevelItem(i);
                if (item != current)
                    item->setExpanded(false);
                else
                    item->setExpanded(true);
            }
*/
            m_currentItem=current;
            itemActivated(current,0);
        }
    }
}
void FmFindWidget::init()
{
    mLayout = new QGraphicsLinearLayout( this );
    mLayout->setOrientation( Qt::Vertical );
 
    mContentWidget = new HbStackedWidget( this );
    mLayout->addItem( mContentWidget );
    initSearchPanel();
    mLayout->addItem( mSearchPanel );
    setLayout( mLayout );

    mModel = new FmFindResultModel( this );
    mModel->setObjectName( "resultModel" );

    connect( mModel, SIGNAL( modelCountChanged( int )),
        this, SLOT( on_resultModel_modelCountChanged( int )), Qt::QueuedConnection );

    connect( mModel, SIGNAL( findStarteded()),
        this, SLOT( on_resultModel_findStarted()) );

    connect( mModel, SIGNAL( findFinished()),
        this, SLOT( on_resultModel_findFinished()) );
    
    mListView = new HbListView( this );
    mListView->setModel( mModel );

    mEmptyTipWidget = new HbWidget( this );
    QGraphicsLinearLayout *emptyTipLayout = new QGraphicsLinearLayout( mEmptyTipWidget );
    HbLabel *emptyTipLable = new HbLabel( hbTrId( "No found files or folders" ), mEmptyTipWidget );
    emptyTipLayout->addItem( emptyTipLable );
    emptyTipLayout->setAlignment( emptyTipLable, Qt::AlignCenter );
    emptyTipLable->setAlignment( Qt::AlignCenter );
 
    mContentWidget->addWidget( mListView );
    mContentWidget->addWidget( mEmptyTipWidget );
    
    mContentWidget->setCurrentWidget( mEmptyTipWidget );
    connect( mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex)));
}
Exemple #29
0
HistoryView::HistoryView(QWidget* parent)
    : QTreeView(parent)
    , m_history(mApp->history())
    , m_filterModel(new HistoryFilterModel(m_history->model()))
{
    setModel(m_filterModel);

    setAllColumnsShowFocus(true);
    setUniformRowHeights(true);
    setSelectionMode(QAbstractItemView::ExtendedSelection);

    m_header = new HeaderView(this);
    setHeader(m_header);

    m_header->setDefaultSectionSizes(QList<double>() << 0.4 << 0.35 << 0.10 << 0.08);
    m_header->setSectionHidden(4, true);

    connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex)));
    connect(this, SIGNAL(pressed(QModelIndex)), this, SLOT(itemPressed(QModelIndex)));

    connect(m_filterModel, SIGNAL(expandAllItems()), this, SLOT(expandAll()));
    connect(m_filterModel, SIGNAL(collapseAllItems()), this, SLOT(collapseAll()));
}
int QListWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QListView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: itemPressed((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 1: itemClicked((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 2: itemDoubleClicked((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 3: itemActivated((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 4: itemEntered((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 5: itemChanged((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break;
        case 6: currentItemChanged((*reinterpret_cast< QListWidgetItem*(*)>(_a[1])),(*reinterpret_cast< QListWidgetItem*(*)>(_a[2]))); break;
        case 7: currentTextChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 8: currentRowChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 9: itemSelectionChanged(); break;
        case 10: scrollToItem((*reinterpret_cast< const QListWidgetItem*(*)>(_a[1])),(*reinterpret_cast< QAbstractItemView::ScrollHint(*)>(_a[2]))); break;
        case 11: scrollToItem((*reinterpret_cast< const QListWidgetItem*(*)>(_a[1]))); break;
        case 12: clear(); break;
        case 13: d_func()->_q_emitItemPressed((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 14: d_func()->_q_emitItemClicked((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 15: d_func()->_q_emitItemDoubleClicked((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 16: d_func()->_q_emitItemActivated((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 17: d_func()->_q_emitItemEntered((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 18: d_func()->_q_emitItemChanged((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 19: d_func()->_q_emitCurrentItemChanged((*reinterpret_cast< const QModelIndex(*)>(_a[1])),(*reinterpret_cast< const QModelIndex(*)>(_a[2]))); break;
        case 20: d_func()->_q_sort(); break;
        case 21: d_func()->_q_dataChanged((*reinterpret_cast< const QModelIndex(*)>(_a[1])),(*reinterpret_cast< const QModelIndex(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 22;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = count(); break;
        case 1: *reinterpret_cast< int*>(_v) = currentRow(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isSortingEnabled(); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 1: setCurrentRow(*reinterpret_cast< int*>(_v)); break;
        case 2: setSortingEnabled(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 3;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}