D11664: added support for Drag (on) and Drop (off) the bookmark toolbar

David Rosca noreply at phabricator.kde.org
Fri Mar 30 11:44:01 BST 2018


drosca added inline comments.

INLINE COMMENTS

> bookmarkitem.h:31
>  {
> +    Q_OBJECT
> +

This is not needed.

> bookmarksmodel.cpp:363
> +
> +QPoint BookmarksButtonMimeData::pos() const
> +{

Why does it still need `pos`? Index of item in layout is just index of BookmarkItem in parent->children.

> bookmarksmodel.h:123
> +private:
> +    QPointer<BookmarkItem> m_item;
> +    QPoint m_pos;

No QPointer.

> bookmarkstoolbar.cpp:34
>  
> +#define MIMETYPE QSL("application/falkon.bookmarktoolbutton.bookmarkitem")
> +

You already have it in static `BookmarksButtonMimeData::mimeType()`

> bookmarkstoolbar.cpp:284
> +{
> +    calcDropRow(e);
> +    update();

Just set `m_dragPos` here and you can remove `calcDropRow` if you do the calculation in paintEvent instead.

> bookmarkstoolbar.cpp:316
> +{
> +    Q_UNUSED(p);
> +

This needs to call QWidget::paintEvent too.

> bookmarkstoolbarbutton.cpp:307
> +
> +        QDrag* drag = new QDrag(this);
> +        BookmarksButtonMimeData* mime = new BookmarksButtonMimeData;

`QDrag *drag`

> bookmarkstoolbarbutton.cpp:315
> +    }
> +}
> +

This still needs to call mouseMoveEvent of parent class.

  if ((event->pos() - m_dragStartPosition).manhattanLength() < QApplication::startDragDistance()) {
      QPushButton::mouseMoveEvent(event);
      return;
  }

> bookmarkstoolbarbutton.h:70
>      void mouseReleaseEvent(QMouseEvent* event) override;
> +    void mouseMoveEvent(QMouseEvent* event) override;
>      void paintEvent(QPaintEvent* event) override;

`QMouseEvent *event`

> qztools.h:100
> +
> +    static void paintDropIndicator(QWidget *parent, QRect r);
>  };

`const QRect &r` and rename parent -> widget.

REPOSITORY
  R875 Falkon

REVISION DETAIL
  https://phabricator.kde.org/D11664

To: anmolgautam, drosca, #falkon
Cc: falkon, herrold, ixoos, anmolgautam, iodelay, spoorun, navarromorales, cochise, clivej, ach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/falkon/attachments/20180330/8ab118b9/attachment.html>


More information about the Falkon mailing list