DISABLE_COMPILER_WARNINGS #include <QApplication> #include <QDragMoveEvent> #include <QHeaderView> #include <QKeyEvent> #include <QMouseEvent> RESTORE_COMPILER_WARNINGS #include <time.h> #include <set> #if defined __linux__ || defined __APPLE__ #include "cfocusframestyle.h" #endif CFileListView::CFileListView(QWidget *parent) : QTreeView(parent), _controller(CController::get()), _panelPosition(UnknownPanel), _bHeaderAdjustmentRequired(true), _singleMouseClickValid(false), _shiftPressedItemSelected(false) { setMouseTracking(true); setItemDelegate(new CFileListItemDelegate); connect(this, &QTreeView::doubleClicked, [this](const QModelIndex &idx) { _itemUnderCursorBeforeMouseClick = QModelIndex(); _singleMouseClickValid = false; for(FileListViewEventObserver* observer: _eventObservers) { if (observer->fileListReturnPressOrDoubleClickPerformed(idx)) break; } }); QHeaderView * headerView = header(); assert_r(headerView); headerView->installEventFilter(this); #if defined __linux__ || defined __APPLE__ setStyle(new CFocusFrameStyle); #endif }
ConditionWidget::ConditionWidget(ComplexCondition* condition, QWidget *parent) : QListView(parent) { mModel = new QStandardItemModel(this); setModel(mModel); setEditTriggers(QAbstractItemView::NoEditTriggers); setItemDelegate(new ConditionWidgetDelegate(this)); setCondition(condition); setContextMenuPolicy(Qt::ActionsContextMenu); mSelectedCondition = 0; QAction* deleteAction = new QAction(QIcon(":/media/delete.png"), tr("Delete"), this); deleteAction->setShortcut(QKeySequence::Delete); deleteAction->setShortcutContext(Qt::WidgetShortcut); addAction(deleteAction); connect(deleteAction, SIGNAL(triggered()), this, SLOT(onDeleteTriggered())); }
LayerTreeWidget::LayerTreeWidget(QWidget *parent) : QTreeWidget(parent) { m_itemDelegate = new MyItemDelegate(this); setItemDelegate(m_itemDelegate); // QAction* act = new QAction("Select All", this); // act->setShortcut(QKeySequence("Ctrl+A")); // act->setShortcutContext(Qt::WidgetWithChildrenShortcut); // connect(act, SIGNAL(triggered()), SLOT(selectAll())); // this->addAction(act); setDragEnabled(true); viewport()->setAcceptDrops(true); setDropIndicatorShown(true); setDragDropMode(QAbstractItemView::InternalMove); }
TupItemManager::TupItemManager(QWidget *parent) : TreeListWidget(parent), m_currentFolder(0) { currentSelection = ""; setHeaderLabels(QStringList() << "" << ""); header()->setSectionResizeMode(QHeaderView::ResizeToContents); setItemDelegate(new TupTreeDelegate(this)); setColumnCount(3); setAcceptDrops(true); setDragEnabled(true); setDropIndicatorShown(true); setDragDropMode(QAbstractItemView::InternalMove); foldersTotal = 1; }
PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient *_client, TabGame *_game, QWidget *parent) : QTreeWidget(parent), tabSupervisor(_tabSupervisor), client(_client), game(_game), gameStarted(false) { readyIcon = QIcon(":/resources/icon_ready_start.svg"); notReadyIcon = QIcon(":/resources/icon_not_ready_start.svg"); concededIcon = QIcon(":/resources/icon_conceded.svg"); playerIcon = QIcon(":/resources/icon_player.svg"); spectatorIcon = QIcon(":/resources/icon_spectator.svg"); lockIcon = QIcon(":/resources/lock.svg"); if (tabSupervisor) { itemDelegate = new PlayerListItemDelegate(this); setItemDelegate(itemDelegate); userContextMenu = new UserContextMenu(tabSupervisor, this, game); connect(userContextMenu, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool))); } else
TestLevelTreeView::TestLevelTreeView(TestLevelController* controller, QWidget* parent): QTreeView(parent), _controller(controller), _oldX(-1), _oldY(-1) { _delegate = new TestLevelTreeItemDelegate; setItemDelegate(_delegate); setItemsExpandable(false); connect(_delegate, SIGNAL(moveVertex(QModelIndex,int,bool)), this, SLOT(movingVertex(QModelIndex,int,bool))); connect(_controller, SIGNAL(update(void)), this, SLOT(expandAll(void))); connect(_controller, SIGNAL(selection(void)), this, SLOT(selection(void))); resize(375, 500); }
QtPropertyEditor::QtPropertyEditor(QWidget *parent /* = 0 */) : QTreeView(parent) , updateTimeout(0) , doUpdateOnPaintEvent(false) { curModel = new QtPropertyModel(); setModel(curModel); curItemDelegate = new QtPropertyItemDelegate(); setItemDelegate(curItemDelegate); QObject::connect(this, SIGNAL(clicked(const QModelIndex &)), this, SLOT(OnItemClicked(const QModelIndex &))); QObject::connect(this, SIGNAL(expanded(const QModelIndex &)), curItemDelegate, SLOT(expand(const QModelIndex &))); QObject::connect(this, SIGNAL(collapsed(const QModelIndex &)), curItemDelegate, SLOT(collapse(const QModelIndex &))); QObject::connect(curModel, SIGNAL(ItemEdited(const QString &, QtPropertyData *)), this, SLOT(OnItemEdited(const QString &, QtPropertyData *))); QObject::connect(&updateTimer, SIGNAL(timeout()), this, SLOT(OnUpdateTimeout())); }
void TreeView::init() { if (!check()) { return; } m_treeViewDelegate->setParent(this); setItemDelegate(m_treeViewDelegate); setModel(m_treeViewModel); setHeader(m_treeViewHeader); setAttribute(Qt::WA_TranslucentBackground); setWindowFlags(windowFlags() | Qt::FramelessWindowHint); setFrameStyle(QFrame::NoFrame); //È¥µô×ó²à¿Õ°× setIndentation(0); setEditTriggers(TreeView::NoEditTriggers); }
void XTableView::setTable() { if (_model->tableName() == _tableName) return; if (!_tableName.isEmpty()) { QString tablename=_tableName; if (!_schemaName.isEmpty()) tablename = _schemaName + "." + tablename; _model->setTable(tablename,_keyColumns); setModel(_model); setItemDelegate(new XItemDelegate(this)); // setRelations(); } }
NTrashTree::NTrashTree(QWidget *parent) : QTreeWidget(parent) { this->count = 0; QFont f = this->font(); f.setPointSize(8); this->setFont(f); filterPosition = -1; // setup options this->setEditTriggers(QAbstractItemView::NoEditTriggers); this->setSelectionBehavior(QAbstractItemView::SelectRows); this->setSelectionMode(QAbstractItemView::ExtendedSelection); this->setRootIsDecorated(true); this->setSortingEnabled(false); this->header()->setVisible(false); this->setContentsMargins(10,10,10,10); //this->setStyleSheet("QTreeWidget { border: none; background-color:transparent; }"); // Build the root item QIcon icon(":trash.png"); root = new QTreeWidgetItem(this); root->setIcon(0,icon); root->setData(0, Qt::UserRole, "root"); root->setData(0, Qt::DisplayRole, tr("Trash")); QFont font = root->font(0); font.setBold(true); root->setFont(0,font); this->setMinimumHeight(1); this->addTopLevelItem(root); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(calculateHeight())); connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this, SLOT(calculateHeight())); connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(buildSelection())); restoreAction = contextMenu.addAction(tr("Restore Deleted Notes")); connect(restoreAction, SIGNAL(triggered()), SLOT(restoreAll())); contextMenu.addSeparator(); expungeAction = contextMenu.addAction(tr("Empty Trash")); connect(expungeAction, SIGNAL(triggered()), this, SLOT(expungeAll())); setItemDelegate(new NTrashViewDelegate()); this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); this->setFrameShape(QFrame::NoFrame); }
AnimationView::AnimationView( Project* project, QWidget *parent /*= 0 */ ) : QListView( parent ) { this->project = project; setFlow( QListView::LeftToRight ); setItemDelegate(new AnimationViewDelegate); setDragEnabled( true ); setAcceptDrops( true ); setDropIndicatorShown( true ); setDragDropMode( QAbstractItemView::DragDrop ); setDefaultDropAction( Qt::MoveAction ); setSelectionMode( ExtendedSelection ); }
TagListWidget::TagListWidget( QWidget* parent ) : QTreeWidget( parent ) , m_currentReply( 0 ) { setColumnCount( 2 ); setRootIsDecorated( false ); setContextMenuPolicy( Qt::CustomContextMenu ); setFrameStyle( NoFrame ); setAlternatingRowColors( true ); setDragEnabled( true ); class TallerRowDelegate : public QItemDelegate { virtual QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const { return QItemDelegate::sizeHint( option, index ) + QSize( 0, 4 ); } }; setItemDelegate( new TallerRowDelegate ); QTreeWidget::hideColumn( 1 ); QTreeWidget::header()->hide(); m_menu = new QMenu( this ); QActionGroup* group = new QActionGroup( this ); QAction* a = m_menu->addAction( tr( "Sort by Popularity" ) ); connect( a, SIGNAL(triggered()), SLOT(sortByPopularity()) ); group->addAction( a ); a->setCheckable( true ); a->setChecked( true ); a = m_menu->addAction( tr( "Sort Alphabetically" ) ); connect( a, SIGNAL(triggered()), SLOT(sortAlphabetically()) ); group->addAction( a ); a->setCheckable( true ); m_menu->addSeparator(); a = m_menu->addAction( tr("Open Last.fm Page for this Tag") ); connect( a, SIGNAL(triggered()), SLOT(openTagPageForCurrentItem()) ); connect( this, SIGNAL(customContextMenuRequested( QPoint )), SLOT(showMenu( QPoint )) ); connect( this, SIGNAL(doubleClicked( const QModelIndex& )), SLOT(onDoubleClicked ( const QModelIndex& )) ); }
AddressWidget::AddressWidget(Window *window, QWidget *parent) : QComboBox(parent), m_window(NULL), m_completer(new QCompleter(AddressCompletionModel::getInstance(), this)), m_bookmarkLabel(NULL), m_feedsLabel(NULL), m_loadPluginsLabel(NULL), m_urlIconLabel(NULL), m_removeModelTimer(0), m_isHistoryDropdownEnabled(SettingsManager::getValue(QLatin1String("AddressField/EnableHistoryDropdown")).toBool()), m_isUsingSimpleMode(false), m_wasPopupVisible(false) { m_completer->setCaseSensitivity(Qt::CaseInsensitive); m_completer->setCompletionMode(QCompleter::InlineCompletion); m_completer->setCompletionRole(Qt::DisplayRole); m_completer->setFilterMode(Qt::MatchStartsWith); setEditable(true); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setMinimumWidth(100); setItemDelegate(new AddressDelegate(this)); setInsertPolicy(QComboBox::NoInsert); setWindow(window); lineEdit()->setCompleter(m_completer); lineEdit()->setStyleSheet(QLatin1String("QLineEdit {background:transparent;}")); lineEdit()->setMouseTracking(true); lineEdit()->installEventFilter(this); ToolBarWidget *toolBar = qobject_cast<ToolBarWidget*>(parent); if (toolBar) { optionChanged(QLatin1String("AddressField/ShowBookmarkIcon"), SettingsManager::getValue(QLatin1String("AddressField/ShowBookmarkIcon"))); optionChanged(QLatin1String("AddressField/ShowUrlIcon"), SettingsManager::getValue(QLatin1String("AddressField/ShowUrlIcon"))); lineEdit()->setPlaceholderText(tr("Enter address or search…")); connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant))); if (toolBar->getIdentifier() != ToolBarsManager::NavigationBar) { connect(toolBar, SIGNAL(windowChanged(Window*)), this, SLOT(setWindow(Window*))); } }
MessagesTreeView::MessagesTreeView(QWidget *parent) : QTreeView(parent) { setRootIsDecorated(true); setItemsExpandable(true); setUniformRowHeights(true); setAlternatingRowColors(true); QPalette pal = palette(); setPalette(pal); setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionMode(QAbstractItemView::SingleSelection); setItemDelegate(new MessagesItemDelegate(this)); header()->setSortIndicatorShown(true); header()->setClickable(true); header()->setMovable(false); setSortingEnabled(true); }
void TCellView::setup() { setItemDelegate(new TCellViewItemDelegate(this)); setSelectionBehavior(QAbstractItemView::SelectItems); setSelectionMode(QAbstractItemView::SingleSelection); verticalHeader()->hide(); horizontalHeader()->hide(); setItemSize(18, 18); // horizontalHeader()->setResizeMode(QHeaderView::Custom); // verticalHeader()->setResizeMode(QHeaderView::Custom); horizontalHeader()->setSectionResizeMode(QHeaderView::Custom); verticalHeader()->setSectionResizeMode(QHeaderView::Custom); }
SymbolView::SymbolView(QWidget* parent) : QListWidget(parent) { setDragEnabled(true); setViewMode(QListView::IconMode); setFlow(QListView::LeftToRight); setSortingEnabled(true); setWrapping(true); setAcceptDrops(true); setDropIndicatorShown(true); setDragDropMode(QAbstractItemView::DragDrop); setResizeMode(QListView::Adjust); setSelectionMode(QAbstractItemView::SingleSelection); setContextMenuPolicy(Qt::CustomContextMenu); delegate = new ScListWidgetDelegate(this, this); setItemDelegate(delegate); setIconSize(QSize(48, 48)); connect(this, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleContextMenu(QPoint))); }
TodoOutputTreeView::TodoOutputTreeView(QWidget *parent) : Utils::TreeView(parent), m_textColumnDefaultWidth(0), m_fileColumnDefaultWidth(0) { setRootIsDecorated(false); setFrameStyle(QFrame::NoFrame); setSortingEnabled(true); setAttribute(Qt::WA_MacShowFocusRect, false); setSelectionBehavior(QTreeView::SelectRows); setItemDelegate(new TodoOutputTreeViewDelegate(this)); header()->setSectionResizeMode(QHeaderView::Interactive); header()->setStretchLastSection(true); header()->setSectionsMovable(false); connect(header(), SIGNAL(sectionResized(int,int,int)), SLOT(todoColumnResized(int,int,int))); loadDisplaySettings(); }
CrosswordGrid::CrosswordGrid( QWidget* parent ) : QTableWidget( parent ) , m_puzzle( 0 ) , m_focusOrientation( FocusHorizontal ) , m_selectedNumber( 0 ) { setEditTriggers( QAbstractItemView::NoEditTriggers ); setSelectionMode( QAbstractItemView::SingleSelection ); setSortingEnabled( false ); setItemDelegate( new CrosswordCellDelegate(this) ); horizontalHeader()->hide(); verticalHeader()->hide(); connect( this, SIGNAL( currentCellChanged(int, int, int, int) ), this, SLOT ( cellSelectedChanged() ) ); }
AMPenStyleComboBox::AMPenStyleComboBox(QWidget *parent) : QComboBox(parent) { setToolTip(QString("Line Style")); for(int iPenStyle = Qt::NoPen, lastPenStyle = Qt::CustomDashLine; iPenStyle < lastPenStyle; ++iPenStyle) { addItem(QString(), QVariant(iPenStyle)); } setItemDelegate(new AMPenStyleDelegate(this)); setCurrentIndex(1); connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int))); }
DeviceView::DeviceView(QWidget* parent) : AutoExpandingTreeView(parent), app_(NULL), merged_model_(NULL), sort_model_(NULL), properties_dialog_(new DeviceProperties), device_menu_(NULL), library_menu_(NULL) { setItemDelegate(new DeviceItemDelegate(this)); SetExpandOnReset(false); setAttribute(Qt::WA_MacShowFocusRect, false); setHeaderHidden(true); setAllColumnsShowFocus(true); setDragEnabled(true); setDragDropMode(QAbstractItemView::DragOnly); setSelectionMode(QAbstractItemView::ExtendedSelection); }
/** * Constructs a QFilterView with the given @p parent. */ QFilterView::QFilterView( QWidget* parent ) : QTableView(parent), d(new QFilterViewPrivate(this)) { setItemDelegate(new QFilterViewItemDelegate(this)); setHorizontalHeader(new QAdvancedHeaderView(Qt::Horizontal, this)); setVerticalHeader(new QAdvancedHeaderView(Qt::Vertical, this)); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); QAbstractButton* cb = findChild<QAbstractButton*>(); if (cb){ cb->disconnect(); connect(cb, SIGNAL(clicked()), this, SIGNAL(cornerButtonClicked())); } updateGeometry(); }
InlineView::InlineView(QWidget* parent) : QListWidget(parent) { setDragEnabled(true); setViewMode(QListView::IconMode); setFlow(QListView::LeftToRight); setSortingEnabled(true); setWrapping(true); setAcceptDrops(true); setDropIndicatorShown(true); setDragDropMode(QAbstractItemView::DragDrop); setResizeMode(QListView::Adjust); setSelectionMode(QAbstractItemView::SingleSelection); setContextMenuPolicy(Qt::CustomContextMenu); delegate = new ScListWidgetDelegate(this, this); delegate->setIconOnly(true); setItemDelegate(delegate); setIconSize(QSize(50, 50)); }
PlIconView::PlIconView( PLModel *model, QWidget *parent ) : QListView( parent ) { PlIconViewItemDelegate *delegate = new PlIconViewItemDelegate( this ); setModel( model ); setViewMode( QListView::IconMode ); setMovement( QListView::Static ); setResizeMode( QListView::Adjust ); setWrapping( true ); setUniformItemSizes( true ); setSelectionMode( QAbstractItemView::ExtendedSelection ); setDragEnabled(true); setAttribute( Qt::WA_MacShowFocusRect, false ); /* dropping in QListView::IconMode does not seem to work */ //setAcceptDrops( true ); //setDropIndicatorShown(true); setItemDelegate( delegate ); }
void DCellView::setup() { setItemDelegate( new DCellViewItemDelegate(this)); setSelectionBehavior(QAbstractItemView::SelectItems); setSelectionMode (QAbstractItemView::SingleSelection); verticalHeader()->hide(); horizontalHeader()->hide(); setItemSize( 18, 18 ); horizontalHeader()->setResizeMode(QHeaderView::Custom); verticalHeader()->setResizeMode(QHeaderView::Custom); // #if QT_VERSION >= 0x040100 // setAutoFillBackground(true); // #endif }
KoResourceSelector::KoResourceSelector( QSharedPointer<KoAbstractResourceServerAdapter> resourceAdapter, QWidget * parent ) : QComboBox( parent ), d( new Private() ) { Q_ASSERT(resourceAdapter); setView( new KoResourceItemView(this) ); setModel( new KoResourceModel(resourceAdapter, this) ); setItemDelegate( new KoResourceItemDelegate( this ) ); setMouseTracking(true); d->updateIndex(this); connect( this, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int)) ); connect(resourceAdapter.data(), SIGNAL(resourceAdded(KoResource*)), this, SLOT(resourceAdded(KoResource*))); connect(resourceAdapter.data(), SIGNAL(removingResource(KoResource*)), this, SLOT(resourceRemoved(KoResource*))); }
LocationCompleterView::LocationCompleterView() : QListView(0) , m_ignoreNextMouseMove(false) { setWindowFlags(Qt::Popup); setUniformItemSizes(true); setEditTriggers(QAbstractItemView::NoEditTriggers); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionMode(QAbstractItemView::SingleSelection); setMouseTracking(true); installEventFilter(this); m_delegate = new LocationCompleterDelegate(this); setItemDelegate(m_delegate); }
/*! \param pStackFramesWidget - pointer to StackFramesWidget */ StackFramesTreeWidget::StackFramesTreeWidget(StackFramesWidget *pStackFramesWidget) : QTreeWidget(pStackFramesWidget) { mpStackFramesWidget = pStackFramesWidget; setItemDelegate(new ItemDelegate(this)); setTextElideMode(Qt::ElideMiddle); setIconSize(Helper::iconSize); setColumnCount(3); QStringList headers; headers << tr("Function") << Helper::line << Helper::file; setHeaderLabels(headers); setIndentation(0); setExpandsOnDoubleClick(false); setContextMenuPolicy(Qt::CustomContextMenu); createActions(); connect(mpStackFramesWidget->getMainWindow()->getGDBAdapter(), SIGNAL(stackListFrames(GDBMIValue*)), SLOT(createStackFrames(GDBMIValue*))); connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), mpStackFramesWidget, SLOT(stackItemDoubleClicked(QTreeWidgetItem*))); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); }
KateArgumentHintTree::KateArgumentHintTree( KateCompletionWidget* parent ) : ExpandingTree(0), m_parent(parent) { //Do not use the completion-widget as widget-parent, because the argument-hint-tree will be rendered separately setFrameStyle( QFrame::Box | QFrame::Plain ); setLineWidth( 1 ); connect( parent, SIGNAL(destroyed(QObject*)), this, SLOT(deleteLater()) ); setFrameStyle(QFrame::NoFrame); setFrameStyle( QFrame::Box | QFrame::Plain ); setFocusPolicy(Qt::NoFocus); setWindowFlags(Qt::Tool | Qt::FramelessWindowHint); setUniformRowHeights(false); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); header()->hide(); setRootIsDecorated(false); setIndentation(0); setAllColumnsShowFocus(true); setAlternatingRowColors(true); setItemDelegate(new KateCompletionDelegate(parent->argumentHintModel(), parent)); }
CodeComboBox::CodeComboBox(QWidget *parent) : QComboBox(parent) { setModel(new CodeComboBoxModel(this)); setItemDelegate(new CodeComboBoxDelegate(this)); CodeLineEdit *codeLineEdit = new CodeLineEdit(parent); codeLineEdit->setEmbedded(true); setLineEdit(codeLineEdit); setEditable(true); setInsertPolicy(QComboBox::NoInsert); connect(codeLineEdit, SIGNAL(codeChanged(bool)), this, SIGNAL(codeChanged(bool))); addActions(codeLineEdit->actions()); setMinimumWidth(sizeHint().width() + codeLineEdit->codeButton()->maximumWidth() + codeLineEdit->editorButton()->maximumWidth() + 50); }
OperatorLibraryView::OperatorLibraryView(QWidget* parent) : QTreeView(parent), m_model(0) { m_model = new OperatorLibraryModel(this); setModel(m_model); setItemDelegate(new ItemDelegate(this)); #ifdef STROMX_STUDIO_QT4 header()->setResizeMode(OperatorLibraryModel::OPERATOR, QHeaderView::Interactive); header()->setResizeMode(OperatorLibraryModel::VERSION, QHeaderView::Stretch); #else header()->setSectionResizeMode(OperatorLibraryModel::OPERATOR, QHeaderView::Interactive); header()->setSectionResizeMode(OperatorLibraryModel::VERSION, QHeaderView::Stretch); #endif // STROMX_STUDIO_QT4 setAlternatingRowColors(true); }