Example #1
0
GameList::GameList(Filter* filter, QWidget* parent) : TableView(parent)
{
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setObjectName("GameList");
    setWindowTitle(tr("Game list"));
    m_model = new FilterModel(filter);

    sortModel = new GameListSortModel(0);
    sortModel->setSourceModel(m_model);
    sortModel->setDynamicSortFilter(false);
    setModel(sortModel);

    connect(this, SIGNAL(clicked(const QModelIndex&)), SLOT(itemSelected(const QModelIndex&)));
    connect(this, SIGNAL(activated(const QModelIndex&)), SLOT(itemSelected(const QModelIndex&)));
    connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(slotContextMenu(const QPoint&)));
    connect(selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)),
            this, SLOT(slotItemSelected(QModelIndex)));
#if QT_VERSION < 0x050000
    horizontalHeader()->setClickable(true);
#else
    horizontalHeader()->setSectionsClickable(true);
#endif

    slotReconfigure();

    horizontalHeader()->setSortIndicatorShown(true);
    setSortingEnabled(true);

    setDragEnabled(true);
    setAcceptDrops(true);
}
KopeteAccountConfig::KopeteAccountConfig( QWidget *parent, const char * /* name */, const QStringList &args )
: KCModule( KopeteAccountConfigFactory::instance(), parent, args )
{

	( new QVBoxLayout( this ) )->setAutoAdd( true );
	m_view = new KopeteAccountConfigBase( this, "KopeteAccountConfig::m_view" );

	m_view->mButtonUp->setIconSet( SmallIconSet( "up" ) );
	m_view->mButtonDown->setIconSet( SmallIconSet( "down" ) );

	connect( m_view->mButtonNew,    SIGNAL( clicked() ), this, SLOT( slotAddAccount() ) );
	connect( m_view->mButtonEdit,   SIGNAL( clicked() ), this, SLOT( slotEditAccount() ) );
	connect( m_view->mButtonRemove, SIGNAL( clicked() ), this, SLOT( slotRemoveAccount() ) );
	connect( m_view->mButtonUp,     SIGNAL( clicked() ), this, SLOT( slotAccountUp() ) );
	connect( m_view->mButtonDown,   SIGNAL( clicked() ), this, SLOT( slotAccountDown() ) );
	connect( m_view->mAccountList,  SIGNAL( selectionChanged() ), this, SLOT( slotItemSelected() ) );
	connect( m_view->mAccountList,  SIGNAL( doubleClicked( QListViewItem * ) ), this, SLOT( slotEditAccount() ) );
	connect( m_view->mUseColor,     SIGNAL( toggled( bool ) ), this, SLOT( slotColorChanged() ) );
	connect( m_view->mColorButton,  SIGNAL( changed( const QColor & ) ), this, SLOT( slotColorChanged() ) );

	m_view->mAccountList->setSorting(-1);

	setButtons( Help );
	load();
}
TemplateManagementDialog::TemplateManagementDialog(
  QWidget *parent, const QStringList &templates, const QString &type )
  : KDialog( parent ), m_templates( templates ), m_type( type ), m_changed( false )
{
  QString m_type_translated = i18n( qPrintable( m_type ) );
  setCaption( i18n( "Manage %1 Templates", m_type_translated ) );
  setButtons( Ok | Cancel | Help );
  setObjectName( "template_management_dialog" );
  setHelp( "entering-data-events-template-buttons", "korganizer" );
  QWidget *widget = new QWidget( this );
  widget->setObjectName( "template_management_dialog_base" );
  m_base.setupUi( widget );
  setMainWidget( widget );

  m_base.m_listBox->addItems( m_templates );
  m_base.m_listBox->setSelectionMode( QAbstractItemView::SingleSelection );

  connect( m_base.m_buttonAdd, SIGNAL(clicked()),
           SLOT(slotAddTemplate()) );
  connect( m_base.m_buttonRemove, SIGNAL(clicked()),
           SLOT(slotRemoveTemplate()) );
  connect( m_base.m_buttonApply, SIGNAL(clicked()),
           SLOT(slotApplyTemplate()) );

  connect( m_base.m_listBox, SIGNAL(itemSelectionChanged()),
           SLOT(slotItemSelected()) );
  connect( m_base.m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
           SLOT(slotApplyTemplate()) );
  connect( this, SIGNAL(okClicked()), SLOT(slotOk()) );

  m_base.m_buttonRemove->setEnabled( false );
  m_base.m_buttonApply->setEnabled( false );
}
void TIconView::keyPressEvent(QKeyEvent* event)
{
    if( (event->key() ==  Qt::Key_Return) || (event->key() == Qt::Key_Enter) )
        slotItemSelected(currentItem());

    QIconView::keyPressEvent(event);
}
void KexiComboBoxBase::slotRowAccepted(KexiDB::RecordData* record, int row)
{
    Q_UNUSED(row);
    //update our value
    //..nothing to do?
    updateButton();
    slotItemSelected(record);
    /*emit*/acceptRequested();
}
void KopeteAccountConfig::slotAccountDown()
{
	KopeteAccountLVI *itemSelected = static_cast<KopeteAccountLVI*>( m_view->mAccountList->selectedItem() );
	if ( !itemSelected )
		return;

	itemSelected->moveItem( itemSelected->itemBelow() );

	slotItemSelected();
	emit changed( true );
}
Example #7
0
void ModuleTreeView::keyPressEvent(QKeyEvent *e)
{
  if (!currentItem()) return;

  if(e->key() == Key_Return
     || e->key() == Key_Enter
        || e->key() == Key_Space)
    {
      //QCursor::setPos(mapToGlobal(QPoint(10, currentItem()->itemPos()+5)));
      slotItemSelected(currentItem());
    }
  else
    KListView::keyPressEvent(e);
}
void KopeteAccountConfig::load()
{
	KopeteAccountLVI *lvi = 0L;

	m_view->mAccountList->clear();

	QPtrList<Kopete::Account> accounts = Kopete::AccountManager::self()->accounts();
	for ( Kopete::Account *i = accounts.first() ; i; i = accounts.next() )
	{
		// Insert the item after the previous one
		lvi = new KopeteAccountLVI( i, m_view->mAccountList );
		lvi->setText( 0, i->protocol()->displayName() );
		lvi->setPixmap( 0, i->accountIcon() );
		lvi->setText( 1, i->accountLabel() );
	}

	m_newColors.clear();
	slotItemSelected();
}
Example #9
0
/**
 * Class constructor.
 * @param	nSearchCol	The list column on which to perform string look-ups
 * @param	pParent		The parent widget
 * @param	szName		The widget's name
 */
SearchList::SearchList(int nSearchCol, QWidget* pParent, const char* szName) :
	QVBox(pParent, szName),
	m_nSearchCol(nSearchCol)
{
	// Create the child widgets
	m_pEdit = new SearchLineEdit(this);
	m_pList = new QListView(this);
	
	// Set up the tooltip generator
	QToolTip::remove(m_pList);
	m_pToolTip = new ListToolTip(this);
	
	connect(m_pEdit, SIGNAL(textChanged(const QString&)), this,
		SLOT(slotFindItem(const QString&)));
	connect(m_pList, SIGNAL(doubleClicked(QListViewItem*)), this,
		SLOT(slotItemSelected(QListViewItem*)));
	connect(m_pList, SIGNAL(returnPressed(QListViewItem*)), this,
		SLOT(slotItemSelected(QListViewItem*)));
	connect(m_pEdit, SIGNAL(returnPressed()), this,
		SLOT(slotItemSelected()));
	connect(m_pEdit, SIGNAL(keyPressed(QKeyEvent*)), this,
		SLOT(slotKeyPressed(QKeyEvent*)));
}
Example #10
0
/**
 * Class constructor.
 * @param	nSearchCol	The list column on which to perform string look-ups
 * @param	pParent		The parent widget
 * @param	szName		The widget's name
 */
SearchList::SearchList(int nSearchCol, QWidget* pParent, const char* szName) :
	QWidget(pParent),
	m_nSearchCol(nSearchCol)
{
	Q_UNUSED(szName);

	// Create the child widgets
	QVBoxLayout *pLayout = new QVBoxLayout;

	m_pEdit = new SearchLineEdit();
	m_pList = new QTreeWidget();
	m_pList->setAllColumnsShowFocus(true);
	m_pList->setRootIsDecorated(false);
	m_pList->setAlternatingRowColors(true);
	m_pList->setColumnCount(3);

	m_pList->setSelectionBehavior(QAbstractItemView::SelectRows);
	m_pList->setSelectionMode(QAbstractItemView::SingleSelection);

	// Set up the tooltip generator
	m_pList->setToolTip(QString());
	m_pToolTip = new QString();

	pLayout->addWidget(m_pEdit);
	pLayout->addWidget(m_pList);
	setLayout(pLayout);

	connect(m_pEdit, SIGNAL(textChanged(const QString&)), this,
		SLOT(slotFindItem(const QString&)));
	connect(m_pEdit, SIGNAL(returnPressed()), this,
		SLOT(slotItemSelected()));
	connect(m_pEdit, SIGNAL(keyPressed(QKeyEvent*)), this,
		SLOT(slotKeyPressed(QKeyEvent*)));

	connect(m_pList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this,
		SLOT(slotItemSelected(QTreeWidgetItem*, int)));
}
Example #11
0
KMyMoneyCategory::KMyMoneyCategory(QWidget* parent, bool splitButton) :
    KMyMoneyCombo(true, parent),
    d(new Private)
{
  if (splitButton) {
    d->frame = new QFrame(0);
    // don't change the following name unless you want to break TransactionEditor::setup()
    d->frame->setObjectName("KMyMoneyCategoryFrame");
    d->frame->setFocusProxy(this);
    QHBoxLayout* layout = new QHBoxLayout(d->frame);
    layout->setContentsMargins(0, 0, 0, 0);

    // make sure not to use our own overridden version of reparent() here
    KMyMoneyCombo::setParent(d->frame, windowFlags()  & ~Qt::WindowType_Mask);
    KMyMoneyCombo::show();
    if (parent) {
      d->frame->setParent(parent);
      d->frame->show();
    }

    // create button
    KGuiItem splitButtonItem("",
                             QIcon::fromTheme("split"), "", "");
    d->splitButton = new QPushButton(d->frame);
    d->splitButton->setObjectName("splitButton");
    KGuiItem::assign(d->splitButton, splitButtonItem);

    layout->addWidget(this, 5);
    layout->addWidget(d->splitButton);

    installEventFilter(this);
  }

  m_completion = new kMyMoneyAccountCompletion(this);
  connect(m_completion, SIGNAL(itemSelected(QString)), this, SLOT(slotItemSelected(QString)));
  connect(this, SIGNAL(editTextChanged(QString)), m_completion, SLOT(slotMakeCompletion(QString)));
}
Example #12
0
EditorManagerView::EditorManagerView(const EditorManagerHelper *helper, BasicEntityTableModel *model, QWidget *parent)
    : Manhattan::MiniSplitter(parent), _helper(helper), _model(model), _dirty(false), _newRow(false)
{
    _navigatorWidget = new ListNavigatorWidget(_helper->mainTitle());
    _editorWidget = _helper->createEditor();    

    /*
    _buttonBox = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
    _cancelButton = _buttonBox->button(QDialogButtonBox::Cancel);
    _cancelButton->setEnabled(false);
    _saveButton = _buttonBox->button(QDialogButtonBox::Save);
    _saveButton->setEnabled(false);
    _saveButton->setText(_helper->saveChangesButtonText());
    _deleteButton = new QPushButton(_helper->deleteButtonText());
    _buttonBox->addButton(_deleteButton, QDialogButtonBox::ResetRole);
    */

    _deleteButton = new QPushButton(tr("Delete"));
    _deleteButton->setEnabled(false);
    _saveButton = new QPushButton(_helper->saveChangesButtonText());
    //_saveButton->setIcon(style()->standardIcon(QStyle::StandardPixmap(QStyle::SP_DialogSaveButton)));
    _saveButton->setEnabled(false);
    _cancelButton = new QPushButton(tr("Cancel"));
    //_cancelButton->setIcon(style()->standardIcon(QStyle::StandardPixmap(QStyle::SP_DialogCancelButton)));
    _cancelButton->setEnabled(false);

    QHBoxLayout * actionsLayout = new QHBoxLayout;
    //actionsLayout->setMargin(6);
    actionsLayout->setSpacing(8);
    actionsLayout->addWidget(_deleteButton);
    actionsLayout->addStretch();
    actionsLayout->addWidget(_saveButton);
    actionsLayout->addWidget(_cancelButton);

    QVBoxLayout * editorLayout = new QVBoxLayout;
    editorLayout->setMargin(9);

    editorLayout->addWidget(_editorWidget);
    editorLayout->addLayout(actionsLayout);
    QWidget * editorWapper = new QWidget;
    editorWapper->setLayout(editorLayout);

    _stackedLayout = new QStackedLayout;
    _stackedLayout->addWidget(helper->createNoDataWidget());
    _stackedLayout->addWidget(editorWapper);

    QVBoxLayout * rightSideLayout = new QVBoxLayout;
    rightSideLayout->setMargin(0);
    rightSideLayout->setSpacing(0);
    rightSideLayout->addWidget(new Manhattan::StyledBar);
    rightSideLayout->addLayout(_stackedLayout);

    QWidget * rightSplitWidget = new QWidget;
    rightSplitWidget->setLayout(rightSideLayout);

    insertWidget(0, _navigatorWidget);
    insertWidget(1, rightSplitWidget);
    setStretchFactor(0, 0);
    setStretchFactor(1, 1);

    _model->select();

    _filterProxyModel = new QSortFilterProxyModel(this);
    _filterProxyModel->setSourceModel(_model);
    _filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    _filterProxyModel->setFilterKeyColumn(model->getNameColumn());
    _navigatorWidget->setModel(_filterProxyModel);

    _navigatorWidget->setModelColumn(model->getNameColumn());
    _editorWidget->setModel(_model);
    _editorWidget->setCurrentIndex(-1);

    connect(_navigatorWidget, SIGNAL(filterChanged(QString)), this, SLOT(slotFilterChanged(QString)));
    connect(_navigatorWidget, SIGNAL(itemSelected(QModelIndex)), this, SLOT(slotItemSelected(QModelIndex)), Qt::QueuedConnection);
    connect(_navigatorWidget, SIGNAL(addNewItem()), this, SLOT(slotAddItem()));
    connect(_navigatorWidget, SIGNAL(deleteItem(QModelIndex)), this, SLOT(slotDeleteItem(QModelIndex)));
    connect(_editorWidget, SIGNAL(contentChanged()), this, SLOT(slotContentChanged()));
    //connect(_model, SIGNAL(primeInsert(int,QSqlRecord&)), this, SLOT(slotPrimeInsert(int,QSqlRecord&)));

    //connect(_buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept()));
    //connect(_buttonBox, SIGNAL(rejected()), this, SLOT(slotReject()));
    connect(_saveButton, SIGNAL(clicked(bool)), this, SLOT(slotAccept()));
    connect(_cancelButton, SIGNAL(clicked(bool)), this, SLOT(slotReject()));
    connect(_deleteButton, SIGNAL(clicked()), this, SLOT(slotDelete()));  
}
void KexiComboBoxBase::updateTextForHighlightedRecord()
{
    KexiDB::RecordData* record = popup() ? popup()->tableView()->highlightedItem() : 0;
    if (record)
        slotItemSelected(record);
}