longscroll-qt
2.0.0
Create long scrollable widgets in Qt.
|
Longscroll-qt's central widget. More...
Public Slots | |
virtual void | showingRect (QRect const &rect) override |
Reimplemented from NotifyableScrollContentWidget::showingRect. More... | |
void | showNavigator (int itemIndex) |
Shows the navigatorWidget for the given item index. More... | |
void | showNavigator (int row, int col) |
Shows the navigatorWidget for the given row and column. More... | |
virtual QSize | sizeHint () const override |
Reimplemented from NotifyableScrollContentWidget::sizeHint. More... | |
Signals | |
void | currentItemChanged (int itemIndex, int oldItemIndex) |
This signal is emitted whenever the current item changes. More... | |
void | itemClicked (int row, int col, int itemIndex) |
This signal is emitted whenever an item is left-clicked. More... | |
void | itemDoubleClicked (int row, int col, int itemIndex) |
This signal is emitted whenever an item is double clicked. More... | |
void | itemPressed (int row, int col, int itemIndex) |
This signal is emitted whenever an item is pressed. More... | |
void | itemReleased (int row, int col, int itemIndex) |
This signal is emitted whenever an item is released. More... | |
void | scrollToRequest (int y) |
This signal is emitted when the widget wants to scroll somewhere. More... | |
void | selectionChanged (QList< int > const &selection, QList< int > const &oldSelection) |
This signal is emitted whenever the selection changes. More... | |
Public Member Functions | |
ContentWidget (QWidget *parent=0) | |
Constructs a ContentWidget. More... | |
ContentWidget (int rowHeight, int itemWidth=0, QWidget *parent=0) | |
Constructs a ContentWidget. More... | |
int | findRow (int itemIndex) |
Searches the row of a given item index. More... | |
void | findRowCol (int &row, int &col, int itemIndex) |
Searches the row and column of a given item index. More... | |
bool | getAllowOverfill () const |
int | getCurrentItem () const |
bool | getHandleMouseEvents () const |
int | getHorizontalSpacing () const |
ContentWidgetItemFactory * | getItemFactory () |
QList< ContentItemInfo > const & | getItemInfos () const |
uchar | getItemTrackingScreenPositionPercentageX () const |
ContentWidget::getItemTrackingScreenPositionPercentageX. More... | |
uchar | getItemTrackingScreenPositionPercentageY () const |
ContentWidget::getItemTrackingScreenPositionPercentageY. More... | |
int | getItemWidth () const |
int | getNavigatorHeight () const |
NavigatorWidget * | getNavigatorWidget () |
int | getPrefetchRowsAfter () const |
int | getPrefetchRowsBefore () const |
int | getRowHeight () const |
bool | getScaleRows () const |
QList< int > | getSelectedItems () const |
QAbstractItemView::SelectionMode | getSelectionMode () const |
bool | getShowNavigatorOnClick () const |
bool | getStretchLastRow () const |
bool | getStretchRows () const |
int | getVerticalSpacing () const |
bool | isDragEnabled () const |
bool | isItemTrackingEnabled () const |
void | setAllowOverfill (bool allow) |
void | setCurrentItem (int index) |
void | setDragEnabled (bool enabled) |
void | setHandleMouseEvents (bool handle) |
void | setHorizontalSpacing (int spacing) |
void | setItemFactory (ContentWidgetItemFactory *factory) |
void | setItemInfos (QList< ContentItemInfo > const &infos) |
void | setItemTrackingEnabled (bool enabled) |
void | setItemTrackingScreenPositionPercentage (uchar percentX, uchar percentY) |
Sets the position where the tracking item is searched. More... | |
void | setItemWidth (int width) |
void | setNavigatorHeight (int height) |
void | setNavigatorWidget (NavigatorWidget *nav) |
void | setPrefetchRowsAfter (int rows) |
void | setPrefetchRowsBefore (int rows) |
void | setRowHeight (int height) |
void | setScaleRows (bool scale) |
void | setSelectedItems (QList< int > const &indexes) |
void | setSelectionMode (QAbstractItemView::SelectionMode mode) |
void | setShowNavigatorOnClick (bool show) |
void | setStretchLastRow (bool stretch) |
void | setStretchRows (bool stretch) |
void | setVerticalSpacing (int spacing) |
~ContentWidget () | |
Destroys the widget. More... | |
Public Member Functions inherited from longscroll::NotifyableScrollContentWidget | |
virtual void | showingRect (QRect const &visible)=0 |
Called by NotifyingScrollArea whenever the visible region changes. More... | |
Public Member Functions inherited from QFrame | |
QRect | frameRect () const |
Shadow | frameShadow () const |
Shape | frameShape () const |
int | frameStyle () const |
int | frameWidth () const |
int | lineWidth () const |
int | midLineWidth () const |
QFrame (QWidget *parent, Qt::WindowFlags f) | |
void | setFrameRect (const QRect &) |
void | setFrameShadow (Shadow) |
void | setFrameShape (Shape) |
void | setFrameStyle (int style) |
void | setLineWidth (int) |
void | setMidLineWidth (int) |
virtual QSize | sizeHint () const |
Public Member Functions inherited from QWidget | |
bool | acceptDrops () const |
QString | accessibleDescription () const |
QString | accessibleName () const |
QList< QAction * > | actions () const |
void | activateWindow () |
void | addAction (QAction *action) |
void | addActions (QList< QAction * > actions) |
void | adjustSize () |
bool | autoFillBackground () const |
QPalette::ColorRole | backgroundRole () const |
QBackingStore * | backingStore () const |
QSize | baseSize () const |
QWidget * | childAt (int x, int y) const |
QWidget * | childAt (const QPoint &p) const |
QRect | childrenRect () const |
QRegion | childrenRegion () const |
void | clearFocus () |
void | clearMask () |
bool | close () |
QMargins | contentsMargins () const |
QRect | contentsRect () const |
Qt::ContextMenuPolicy | contextMenuPolicy () const |
QCursor | cursor () const |
void | customContextMenuRequested (const QPoint &pos) |
WId | effectiveWinId () const |
void | ensurePolished () const |
Qt::FocusPolicy | focusPolicy () const |
QWidget * | focusProxy () const |
QWidget * | focusWidget () const |
const QFont & | font () const |
QFontInfo | fontInfo () const |
QFontMetrics | fontMetrics () const |
QPalette::ColorRole | foregroundRole () const |
QRect | frameGeometry () const |
QSize | frameSize () const |
const QRect & | geometry () const |
void | getContentsMargins (int *left, int *top, int *right, int *bottom) const |
QPixmap | grab (const QRect &rectangle) |
void | grabGesture (Qt::GestureType gesture, Qt::GestureFlags flags) |
void | grabKeyboard () |
void | grabMouse () |
void | grabMouse (const QCursor &cursor) |
int | grabShortcut (const QKeySequence &key, Qt::ShortcutContext context) |
QGraphicsEffect * | graphicsEffect () const |
QGraphicsProxyWidget * | graphicsProxyWidget () const |
bool | hasEditFocus () const |
bool | hasFocus () const |
virtual bool | hasHeightForWidth () const |
bool | hasMouseTracking () const |
int | height () const |
virtual int | heightForWidth (int w) const |
void | hide () |
Qt::InputMethodHints | inputMethodHints () const |
virtual QVariant | inputMethodQuery (Qt::InputMethodQuery query) const |
void | insertAction (QAction *before, QAction *action) |
void | insertActions (QAction *before, QList< QAction * > actions) |
bool | isActiveWindow () const |
bool | isAncestorOf (const QWidget *child) const |
bool | isEnabled () const |
bool | isEnabledTo (const QWidget *ancestor) const |
bool | isEnabledToTLW () const |
bool | isFullScreen () const |
bool | isHidden () const |
bool | isMaximized () const |
bool | isMinimized () const |
bool | isModal () const |
bool | isTopLevel () const |
bool | isVisible () const |
bool | isVisibleTo (const QWidget *ancestor) const |
bool | isWindow () const |
bool | isWindowModified () const |
QLayout * | layout () const |
Qt::LayoutDirection | layoutDirection () const |
QLocale | locale () const |
void | lower () |
Qt::HANDLE | macCGHandle () const |
Qt::HANDLE | macQDHandle () const |
QPoint | mapFrom (const QWidget *parent, const QPoint &pos) const |
QPoint | mapFromGlobal (const QPoint &pos) const |
QPoint | mapFromParent (const QPoint &pos) const |
QPoint | mapTo (const QWidget *parent, const QPoint &pos) const |
QPoint | mapToGlobal (const QPoint &pos) const |
QPoint | mapToParent (const QPoint &pos) const |
QRegion | mask () const |
int | maximumHeight () const |
QSize | maximumSize () const |
int | maximumWidth () const |
int | minimumHeight () const |
QSize | minimumSize () const |
virtual QSize | minimumSizeHint () const |
int | minimumWidth () const |
void | move (int x, int y) |
void | move (const QPoint &) |
QWidget * | nativeParentWidget () const |
QWidget * | nextInFocusChain () const |
QRect | normalGeometry () const |
void | overrideWindowFlags (Qt::WindowFlags flags) |
QPaintEngine * | paintEngine () const |
const QPalette & | palette () const |
QWidget * | parentWidget () const |
QPoint | pos () const |
QWidget * | previousInFocusChain () const |
QWidget (QWidget *parent, Qt::WindowFlags f) | |
void | raise () |
QRect | rect () const |
void | releaseKeyboard () |
void | releaseMouse () |
void | releaseShortcut (int id) |
void | removeAction (QAction *action) |
void | render (QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QFlags< QWidget::RenderFlag > renderFlags) |
void | render (QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QFlags< QWidget::RenderFlag > renderFlags) |
void | repaint () |
void | repaint (int x, int y, int w, int h) |
void | repaint (const QRect &rect) |
void | repaint (const QRegion &rgn) |
void | resize (int w, int h) |
void | resize (const QSize &) |
bool | restoreGeometry (const QByteArray &geometry) |
QByteArray | saveGeometry () const |
void | scroll (int dx, int dy, const QRect &r) |
void | scroll (int dx, int dy) |
void | setAcceptDrops (bool on) |
void | setAccessibleDescription (const QString &description) |
void | setAccessibleName (const QString &name) |
void | setAttribute (Qt::WidgetAttribute attribute, bool on) |
void | setAutoFillBackground (bool enabled) |
void | setBackgroundRole (QPalette::ColorRole role) |
void | setBaseSize (int basew, int baseh) |
void | setBaseSize (const QSize &) |
void | setContentsMargins (int left, int top, int right, int bottom) |
void | setContentsMargins (const QMargins &margins) |
void | setContextMenuPolicy (Qt::ContextMenuPolicy policy) |
void | setCursor (const QCursor &) |
void | setDisabled (bool disable) |
void | setEditFocus (bool enable) |
void | setEnabled (bool) |
void | setFixedHeight (int h) |
void | setFixedSize (const QSize &s) |
void | setFixedSize (int w, int h) |
void | setFixedWidth (int w) |
void | setFocus (Qt::FocusReason reason) |
void | setFocus () |
void | setFocusPolicy (Qt::FocusPolicy policy) |
void | setFocusProxy (QWidget *w) |
void | setFont (const QFont &) |
void | setForegroundRole (QPalette::ColorRole role) |
void | setGeometry (const QRect &) |
void | setGeometry (int x, int y, int w, int h) |
void | setGraphicsEffect (QGraphicsEffect *effect) |
void | setHidden (bool hidden) |
void | setInputMethodHints (Qt::InputMethodHints hints) |
void | setLayout (QLayout *layout) |
void | setLayoutDirection (Qt::LayoutDirection direction) |
void | setLocale (const QLocale &locale) |
void | setMask (const QBitmap &bitmap) |
void | setMask (const QRegion ®ion) |
void | setMaximumHeight (int maxh) |
void | setMaximumSize (int maxw, int maxh) |
void | setMaximumSize (const QSize &) |
void | setMaximumWidth (int maxw) |
void | setMinimumHeight (int minh) |
void | setMinimumSize (const QSize &) |
void | setMinimumSize (int minw, int minh) |
void | setMinimumWidth (int minw) |
void | setMouseTracking (bool enable) |
void | setPalette (const QPalette &) |
void | setParent (QWidget *parent) |
void | setParent (QWidget *parent, Qt::WindowFlags f) |
void | setShortcutAutoRepeat (int id, bool enable) |
void | setShortcutEnabled (int id, bool enable) |
void | setSizeIncrement (const QSize &) |
void | setSizeIncrement (int w, int h) |
void | setSizePolicy (QSizePolicy) |
void | setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical) |
void | setStatusTip (const QString &) |
void | setStyle (QStyle *style) |
void | setStyleSheet (const QString &styleSheet) |
void | setToolTip (const QString &) |
void | setToolTipDuration (int msec) |
void | setUpdatesEnabled (bool enable) |
void | setupUi (QWidget *widget) |
virtual void | setVisible (bool visible) |
void | setWhatsThis (const QString &) |
void | setWindowFilePath (const QString &filePath) |
void | setWindowFlags (Qt::WindowFlags type) |
void | setWindowIcon (const QIcon &icon) |
void | setWindowIconText (const QString &) |
void | setWindowModality (Qt::WindowModality windowModality) |
void | setWindowModified (bool) |
void | setWindowOpacity (qreal level) |
void | setWindowRole (const QString &role) |
void | setWindowState (Qt::WindowStates windowState) |
void | setWindowTitle (const QString &) |
void | show () |
void | showFullScreen () |
void | showMaximized () |
void | showMinimized () |
void | showNormal () |
QSize | size () const |
QSize | sizeIncrement () const |
QSizePolicy | sizePolicy () const |
void | stackUnder (QWidget *w) |
QString | statusTip () const |
QStyle * | style () const |
QString | styleSheet () const |
bool | testAttribute (Qt::WidgetAttribute attribute) const |
QString | toolTip () const |
int | toolTipDuration () const |
QWidget * | topLevelWidget () const |
bool | underMouse () const |
void | ungrabGesture (Qt::GestureType gesture) |
void | unsetCursor () |
void | unsetLayoutDirection () |
void | unsetLocale () |
void | update () |
void | update (int x, int y, int w, int h) |
void | update (const QRect &rect) |
void | update (const QRegion &rgn) |
void | updateGeometry () |
bool | updatesEnabled () const |
QRegion | visibleRegion () const |
QString | whatsThis () const |
int | width () const |
QWidget * | window () const |
QString | windowFilePath () const |
Qt::WindowFlags | windowFlags () const |
QWindow * | windowHandle () const |
QIcon | windowIcon () const |
void | windowIconChanged (const QIcon &icon) |
QString | windowIconText () const |
void | windowIconTextChanged (const QString &iconText) |
Qt::WindowModality | windowModality () const |
qreal | windowOpacity () const |
QString | windowRole () const |
Qt::WindowStates | windowState () const |
QString | windowTitle () const |
void | windowTitleChanged (const QString &title) |
Qt::WindowType | windowType () const |
WId | winId () const |
int | x () const |
const QX11Info & | x11Info () const |
Qt::HANDLE | x11PictureHandle () const |
int | y () const |
Protected Member Functions | |
int | colAt (int x, int row) |
This is an overloaded function. More... | |
int | colAt (int x, RowInfo const &row) |
Calculates which column of a row a given x-coordinate belongs to. More... | |
virtual QWidget * | createItemWidget (ContentItemInfo const &info, int itemIndex) |
Creates an item widget. More... | |
virtual void | mouseDoubleClickEvent (QMouseEvent *event) override |
Reimplemented from NotifyableScrollContentWidget::mouseDoubleClickEvent. More... | |
virtual void | mouseMoveEvent (QMouseEvent *event) override |
Reimplemented from NotifyableScrollContentWidget::mouseMoveEvent. More... | |
virtual void | mousePressEvent (QMouseEvent *event) override |
Reimplemented from NotifyableScrollContentWidget::mousePressEvent. More... | |
virtual void | mouseReleaseEvent (QMouseEvent *event) override |
Reimplemented from NotifyableScrollContentWidget::mouseReleaseEvent. More... | |
void | nextImage (int &row, int &col) |
Takes a row and column and changes them to point at the next item. More... | |
void | previousImage (int &row, int &col) |
Takes a row and column and changes them to point at the previous item. More... | |
int | rowAt (int y, bool *onNavigator=0) |
Calculates which row a given y-coordinate belongs to. More... | |
virtual void | startDrag (int row, int col, int itemIndex) |
Begins a drag operation. More... | |
Protected Member Functions inherited from QFrame | |
virtual void | changeEvent (QEvent *ev) |
bool | event (QEvent *e) |
virtual void | paintEvent (QPaintEvent *) |
Protected Member Functions inherited from QWidget | |
virtual void | actionEvent (QActionEvent *event) |
virtual void | closeEvent (QCloseEvent *event) |
virtual void | contextMenuEvent (QContextMenuEvent *event) |
void | create (WId window, bool initializeWindow, bool destroyOldWindow) |
void | destroy (bool destroyWindow, bool destroySubWindows) |
virtual void | dragEnterEvent (QDragEnterEvent *event) |
virtual void | dragLeaveEvent (QDragLeaveEvent *event) |
virtual void | dragMoveEvent (QDragMoveEvent *event) |
virtual void | dropEvent (QDropEvent *event) |
virtual void | enterEvent (QEvent *event) |
bool | event (QEvent *event) |
virtual void | focusInEvent (QFocusEvent *event) |
bool | focusNextChild () |
virtual bool | focusNextPrevChild (bool next) |
virtual void | focusOutEvent (QFocusEvent *event) |
bool | focusPreviousChild () |
virtual void | hideEvent (QHideEvent *event) |
void | initPainter (QPainter *painter) const |
virtual void | inputMethodEvent (QInputMethodEvent *event) |
virtual void | keyPressEvent (QKeyEvent *event) |
virtual void | keyReleaseEvent (QKeyEvent *event) |
virtual void | leaveEvent (QEvent *event) |
int | metric (PaintDeviceMetric m) const |
virtual void | moveEvent (QMoveEvent *event) |
virtual bool | nativeEvent (const QByteArray &eventType, void *message, long *result) |
QPaintDevice * | redirected (QPoint *offset) const |
virtual void | resizeEvent (QResizeEvent *event) |
QPainter * | sharedPainter () const |
virtual void | showEvent (QShowEvent *event) |
virtual void | tabletEvent (QTabletEvent *event) |
void | updateMicroFocus () |
virtual void | wheelEvent (QWheelEvent *event) |
Friends | |
bool | operator== (ContentWidget::ItemInfo const &lhs, ContentWidget::ItemInfo const &rhs) |
bool | operator== (ContentWidget::RowInfo const &lhs, ContentWidget::RowInfo const &rhs) |
Additional Inherited Members | |
Static Public Member Functions inherited from QWidget | |
QWidget * | createWindowContainer (QWindow *window, QWidget *parent, Qt::WindowFlags flags) |
QWidget * | find (WId id) |
QWidget * | keyboardGrabber () |
QWidget * | mouseGrabber () |
void | setTabOrder (QWidget *first, QWidget *second) |
Public Attributes inherited from QWidget | |
typedef | RenderFlags |
Longscroll-qt's central widget.
Implements a widget that can display a lot of items, similar to a QAbstractItemView, but allows dynamic item positions and uses real widgets to display the items, thus there is no MVC concept.
Items can be any kind of data and their number is not limited by this widget, however you may face other limits. For example, any QWidget can only have a size of QWIDGETSIZE_MAX pixels in each dimension. An item is visualized by a widget that is created when the item becomes visible and destroyed when it's hidden. This item widget determines how the item looks and what its data mean. The widget is created using the createItemWidget() function, which again calls ContentWidgetItemFactory::createItemWidget(). This can be customized by setting a different itemFactory or by overriding createItemWidget(), so that a custom widget is returned.
Items are always aligned in rows. The height of the rows can be fixed or dynamic, the width of the items inside a row can also be fixed or dynamic. That way different kind of layouts can be achieved: Tables, lists or Goolge-Image-like views. Set the properties to achieve a layout before seetting itemInfos, since each property change causes re-layouting. The following properties affect the layout: rowHeight, itemWidth, allowOverfill, stretchRows, stretchLastRow, scaleRows, horizontalSpacing, verticalSpacing, itemFactory, navigatorHeight.
ContentWidget offers a so called navigator widget. The navigatorWidget represents a single item and is shown below the row the item is in. It always has a fixed height of navigatorHeight and the full width of this widget. The navigator widget can for example provide additional information about the selected item. By default the navigator widget is shown when an item is clicked, this can be disabled using showNavigatorOnClick.
longscroll::ContentWidget::ContentWidget | ( | QWidget * | parent = 0 | ) |
Constructs a ContentWidget.
parent |
longscroll::ContentWidget::ContentWidget | ( | int | rowHeight, |
int | itemWidth = 0 , |
||
QWidget * | parent = 0 |
||
) |
Constructs a ContentWidget.
rowHeight | |
itemWidth | |
parent |
longscroll::ContentWidget::~ContentWidget | ( | ) |
Destroys the widget.
|
protected |
This is an overloaded function.
|
protected |
Calculates which column of a row a given x-coordinate belongs to.
Since items can have different widths, a row is needed.
x | X-Coordinate. |
row | Row. |
|
protectedvirtual |
Creates an item widget.
This method creates a widget to visualize an item. These widgets are created when the respective item becomes close to the visible region and destroyed when it moves away. For fine control when the widget is created, use prefetchRowsBefore and prefetchRowsAfter. This widget takes ownership of the returned widget.
This method can be overridden. However, the same effect can be achieved by changing the itemFactory.
info | The item info to be displayed. |
itemIndex | List index of the item info. |
|
signal |
This signal is emitted whenever the current item changes.
The previous model item index is replaced by the current index as the selection's current item.
itemIndex | Current item index. |
oldItemIndex | Old current item index. |
int longscroll::ContentWidget::findRow | ( | int | itemIndex | ) |
Searches the row of a given item index.
Uses binary search using std::lower_bound()
to find the row. The itemIndex
must be in the range of the item info list, this is not checked.
itemIndex |
void longscroll::ContentWidget::findRowCol | ( | int & | row, |
int & | col, | ||
int | itemIndex | ||
) |
Searches the row and column of a given item index.
Uses binary search using std::lower_bound()
to find the row, the column is calculated directly. The itemIndex must be in the range of the item info list, this is not checked.
row | Returns the row. |
col | Returns the column. |
itemIndex |
bool longscroll::ContentWidget::getAllowOverfill | ( | ) | const |
int longscroll::ContentWidget::getCurrentItem | ( | ) | const |
bool longscroll::ContentWidget::getHandleMouseEvents | ( | ) | const |
int longscroll::ContentWidget::getHorizontalSpacing | ( | ) | const |
ContentWidgetItemFactory * longscroll::ContentWidget::getItemFactory | ( | ) |
const QList< ContentItemInfo > & longscroll::ContentWidget::getItemInfos | ( | ) | const |
uchar longscroll::ContentWidget::getItemTrackingScreenPositionPercentageX | ( | ) | const |
ContentWidget::getItemTrackingScreenPositionPercentageX.
uchar longscroll::ContentWidget::getItemTrackingScreenPositionPercentageY | ( | ) | const |
ContentWidget::getItemTrackingScreenPositionPercentageY.
int longscroll::ContentWidget::getItemWidth | ( | ) | const |
int longscroll::ContentWidget::getNavigatorHeight | ( | ) | const |
NavigatorWidget * longscroll::ContentWidget::getNavigatorWidget | ( | ) |
int longscroll::ContentWidget::getPrefetchRowsAfter | ( | ) | const |
int longscroll::ContentWidget::getPrefetchRowsBefore | ( | ) | const |
int longscroll::ContentWidget::getRowHeight | ( | ) | const |
bool longscroll::ContentWidget::getScaleRows | ( | ) | const |
QList< int > longscroll::ContentWidget::getSelectedItems | ( | ) | const |
QAbstractItemView::SelectionMode longscroll::ContentWidget::getSelectionMode | ( | ) | const |
bool longscroll::ContentWidget::getShowNavigatorOnClick | ( | ) | const |
bool longscroll::ContentWidget::getStretchLastRow | ( | ) | const |
bool longscroll::ContentWidget::getStretchRows | ( | ) | const |
int longscroll::ContentWidget::getVerticalSpacing | ( | ) | const |
bool longscroll::ContentWidget::isDragEnabled | ( | ) | const |
bool longscroll::ContentWidget::isItemTrackingEnabled | ( | ) | const |
|
signal |
This signal is emitted whenever an item is left-clicked.
The row, column and item inex specify is the item that was clicked.
row | |
col | |
itemIndex |
|
signal |
This signal is emitted whenever an item is double clicked.
The row, column and item inex specify is the item that was double clicked.
row | |
col | |
itemIndex |
|
signal |
This signal is emitted whenever an item is pressed.
The row, column and item inex specify is the item that was pressed. Use the QApplication::mouseButtons() function to get the state of the mouse buttons.
row | |
col | |
itemIndex |
|
signal |
This signal is emitted whenever an item is released.
The row, column and item inex specify is the item that was released. Use the QApplication::mouseButtons() function to get the state of the mouse buttons.
row | |
col | |
itemIndex |
|
overrideprotectedvirtual |
Reimplemented from NotifyableScrollContentWidget::mouseDoubleClickEvent.
Reimplemented from QWidget.
|
overrideprotectedvirtual |
Reimplemented from NotifyableScrollContentWidget::mouseMoveEvent.
Reimplemented from QWidget.
|
overrideprotectedvirtual |
Reimplemented from NotifyableScrollContentWidget::mousePressEvent.
Reimplemented from QWidget.
|
overrideprotectedvirtual |
Reimplemented from NotifyableScrollContentWidget::mouseReleaseEvent.
Reimplemented from QWidget.
|
protected |
Takes a row and column and changes them to point at the next item.
The input row and column have to exist. If there is no next item, row and col will be -1.
row | Row. |
col | Column. |
|
protected |
Takes a row and column and changes them to point at the previous item.
The input row and column have to exist. If there is no previous item, row and col will be -1.
row | Row. |
col | Column. |
|
protected |
Calculates which row a given y-coordinate belongs to.
If the navigator widget is shown and the y-coordinate is on the navigator, the returned row will be the number of the row above the navigator. The optional parameter onNavigator returns if the y-coordinate is on the navigator.
y | Y-Coordinate. |
onNavigator | Returns if y is on the navigator widget. |
|
signal |
This signal is emitted when the widget wants to scroll somewhere.
This happens when the navigator switches a line to keep it steady on the screen, or when itemTrackingEnabled is enabled and the widget is resized and tries to keep one item at one y-coordinate. Can be connected to the setValue() signal of the vertical scroll bar of the containing scroll area.
y | The y-coordiate the widget wants to be visible on the top edge. |
|
signal |
This signal is emitted whenever the selection changes.
selection | New selection. |
oldSelection | Old selection. |
void longscroll::ContentWidget::setAllowOverfill | ( | bool | allow | ) |
void longscroll::ContentWidget::setCurrentItem | ( | int | index | ) |
void longscroll::ContentWidget::setDragEnabled | ( | bool | enabled | ) |
void longscroll::ContentWidget::setHandleMouseEvents | ( | bool | handle | ) |
void longscroll::ContentWidget::setHorizontalSpacing | ( | int | spacing | ) |
void longscroll::ContentWidget::setItemFactory | ( | ContentWidgetItemFactory * | factory | ) |
void longscroll::ContentWidget::setItemInfos | ( | QList< ContentItemInfo > const & | infos | ) |
void longscroll::ContentWidget::setItemTrackingEnabled | ( | bool | enabled | ) |
void longscroll::ContentWidget::setItemTrackingScreenPositionPercentage | ( | uchar | percentX, |
uchar | percentY | ||
) |
Sets the position where the tracking item is searched.
If item tracking is enabled, the tracking item is the item that is found at this position of the visible region. The values are in percent. For example, (0, 0)
is the item at the top left corner, (0, 100)
is the item at the bottom left corner and (50, 50)
is the item at the center.
(0, 0)
percentX | X-coordinate percentage. |
percentY | Y-coordinate percentage. |
void longscroll::ContentWidget::setItemWidth | ( | int | width | ) |
void longscroll::ContentWidget::setNavigatorHeight | ( | int | height | ) |
void longscroll::ContentWidget::setNavigatorWidget | ( | NavigatorWidget * | nav | ) |
void longscroll::ContentWidget::setPrefetchRowsAfter | ( | int | rows | ) |
void longscroll::ContentWidget::setPrefetchRowsBefore | ( | int | rows | ) |
void longscroll::ContentWidget::setRowHeight | ( | int | height | ) |
void longscroll::ContentWidget::setScaleRows | ( | bool | scale | ) |
void longscroll::ContentWidget::setSelectedItems | ( | QList< int > const & | indexes | ) |
void longscroll::ContentWidget::setSelectionMode | ( | QAbstractItemView::SelectionMode | mode | ) |
void longscroll::ContentWidget::setShowNavigatorOnClick | ( | bool | show | ) |
void longscroll::ContentWidget::setStretchLastRow | ( | bool | stretch | ) |
void longscroll::ContentWidget::setStretchRows | ( | bool | stretch | ) |
void longscroll::ContentWidget::setVerticalSpacing | ( | int | spacing | ) |
|
overridevirtualslot |
Reimplemented from NotifyableScrollContentWidget::showingRect.
|
slot |
Shows the navigatorWidget for the given item index.
The index must exist in the item info list.
itemIndex |
|
slot |
Shows the navigatorWidget for the given row and column.
The row and column must exist.
row | |
col |
|
overridevirtualslot |
Reimplemented from NotifyableScrollContentWidget::sizeHint.
|
protectedvirtual |
Begins a drag operation.
If dragging is enabled (dragEnabled), and the user tries to drag an item, this method is called. If you wish to implement some kind of drag support, you have to override this moethod. The default implementation does nothing.
|
readwrite |
Allows the last item in a row to exceed the width of that row.
If allowOverfill
is not set, a row is never wider than the widget.
If allowOverfill
is set, the widget decides for the first item that does not fit inside a row anymore, if it adds the item to the row anyway or creates a new row. The item is added to the row if more than half of the item fits inside the row. This is usually used together with stretchRows or scaleRows.
true
|
readwrite |
Current item index.
|
readwrite |
Enables drag detection, requires handleMouseEvents to be set.
If dragEnabled
is set, the widget detects mouse dragging. If a drag was detected, startDrag is called. Any actual actions need to be implemented by overriding it.
false
|
readwrite |
Handle mouse events.
Handle press, release and move events to change the selection, start dragging, emit events or show navigator.
true
|
readwrite |
Horizontal spacing between items.
5
|
readwrite |
ContentWidgetItemFactory used to create displaying widgets.
This ContentWidget takes ownership of the ContentWidgetItemFactory.
new ContentWidgetImageItemFactory(false, this)
|
readwrite |
The list of ContentItemInfos being displayed.
|
readwrite |
Tries to keep one item at the same screen y-coordinate while resizing.
If item tracking is enabled, an item is memorized when the user scrolls the widget. When the widget is resized, it tries to keep that tracking item at the same screen y-coordinate.
true
|
readwrite |
Item base width.
If itemWidth > 0
, all items will have this width, unless stretchRows is set.
If itemWidth < 0
, all items will have some large width. Only use this to gether with stretchRows and without scaleRows. That has the effect that one item takes exactly one row.
If itemWidth == 0
, the items will have their size assigned by using item.widthForHeight(rowHeight)
, i.e. each item has the width that fits the rowHeight best.
0
|
readwrite |
Navigator widget height.
The navigator widget always has a fixed height.
400
|
readwrite |
new ImageNavigatorWidget(this)
|
readwrite |
Number of rows after the last visible row that should be kept ready for displaying.
These rows are not currently visible, but their widgets still or already exist anyway. This can be useful for example if a widget needs some time to load data from the disk or network.
3
|
readwrite |
Number of rows before the first visible row that should be kept ready for displaying.
These rows are not currently visible, but their widgets still or already exist anyway. This can be useful for example if a widget needs some time to load data from the disk or network.
1
|
readwrite |
Row base height.
If scaleRows is not set, every row will have this height. If scaleRows
is set, this will be the base value to calculate the actual size from. The value must be > 0.
150
|
readwrite |
Scale rows to the actual widget's width, keeping the items' aspect ratio.
Similar to stretchRows, but keeps the aspect ratios of the items. Instead it changes the row height. If enabled, overrides stretchRows, but respects stretchLastRow. For (theoretically) better performance you should disable stretchRows when scaleRows
is set.
Enabling scaleRows
means that rows don't have fixed row heights anymore, which causes some operations to be a bit more complex. For maximum performance, this feature can be disabled completely by compiling the library with CONTENTWIDGET_VARIABLE_ROW_HEIGHT=0
defined. However I found the effective performance impact hardly mensurable.
Don't use scaleRows
with itemWidth < 0
.
false
|
readwrite |
Selected item indexes.
|
readwrite |
Selection mode.
If selectionMode
is set to QAbstractItemView::NoSelection
, the selection is cleared and disabled. Requires handleMouseEvents for mouse selection to work.
Note that selection is not automatically displayed. The item widget has to visualize the selection. ImageItemWidget for example can be configured to visualize selections.
Currently only mouse selection is implemented.
|
readwrite |
Show the navigator widget on item click, requires handleMouseEvents to be set.
true
|
readwrite |
Stretch last row.
The last row can be stretched independently from the other rows. This is because the last row usually is not completely filled and stretching it looks strange.
false
|
readwrite |
Stretch row widths to the actual widget's width.
If stretchRows
is set, all rows will be stretched to the actual widget's width. This is done by stretching all items of a row proportionally to their widths. If stretchRows
is not set, all items will have the size specified by itemWidth. This value does not affect the last row, which is controlled by stretchLastRow.
true
|
readwrite |