Results 1 to 10 of 10

Thread: QT 4.4 QGraphicsProxyWidget bridge Drag and Drop help

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    788
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    49
    Thanked 48 Times in 46 Posts

    Default Re: QGraphicsProxyWidget forward Drag and Drop help

    Quote Originally Posted by wysota View Post
    What do you mean "forward drag and drop"? Does the view accept drops?
    i not think that QGraphicsView must send all drag and drop event to his subitem?
    but it works ...
    i hope to not forward keyPressEvent and all other ...

    Qt Code:
    1. void XhtmlView::dragEnterEvent ( QDragEnterEvent * e )
    2. {
    3. /* DivDiagram *CurrentActive; only xhtml <div> tag */
    4. if (CurrentActive->id() > 0 && CurrentActive->ProxyBridgeEdit->isVisible()) {
    5. CurrentActive->AdvanceEdit->wtxt->insertFromMimeData(e->mimeData());
    6. return;
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QGraphicsProxyWidget forward Drag and Drop help

    But did you enable drops for the view?

  3. #3
    Join Date
    May 2006
    Posts
    788
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    49
    Thanked 48 Times in 46 Posts

    Default Re: QGraphicsProxyWidget forward Drag and Drop help

    Quote Originally Posted by wysota View Post
    But did you enable drops for the view?
    Yes ... but i like only drag drop on subitem QGraphicsProxyWidget an his QWidget
    the doc say : QGraphicsProxyWidget imo forum QTCLASS 4.4beta not found http://doc.trolltech.com/main-snapsh...oxywidget.html
    The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene.
    QGraphicsProxyWidget embeds any QWidget-based widget, for example, a QPushButton, QFontComboBox, or even QFileDialog, into QGraphicsScene. It forwards events between the two objects and translates between QWidget's integer-based geometry and QGraphicsWidget's qreal-based geometry. QGraphicsProxyWidget supports all core features of QWidget, including tab focus, keyboard input, Drag & Drop, and popups. You can also embed complex widgets, e.g., widgets with subwidgets.
    QGraphicsProxyWidget takes care of automatically embedding popup children of embedded widgets through creating a child proxy for each popup. This means that when an embedded QComboBox shows its popup list, a new QGraphicsProxyWidget is created automatically, embedding the popup, and positioning it correctly.
    I wand to build only a xhtml editor that processing div tag floating absolute and display it block or not...
    Attached Images Attached Images

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QGraphicsProxyWidget forward Drag and Drop help

    It could be D&D related event passing through the proxy has not yet been implemented. We are talking about beta software here.

  5. #5
    Join Date
    May 2006
    Posts
    788
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    49
    Thanked 48 Times in 46 Posts

    Default Re: QGraphicsProxyWidget forward Drag and Drop help

    Quote Originally Posted by wysota View Post
    It could be D&D related event passing through the proxy has not yet been implemented. We are talking about beta software here.
    you know another way to display inside QGraphicsView / QGraphicsTextItem an exdended
    xhtml editor? not beta?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QGraphicsProxyWidget forward Drag and Drop help

    Implement a custom QGraphicsItem.

  7. The following user says thank you to wysota for this useful post:

    patrik08 (27th March 2008)

  8. #7
    Join Date
    May 2006
    Posts
    788
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    49
    Thanked 48 Times in 46 Posts

    Default Re: QGraphicsProxyWidget forward Drag and Drop help

    Quote Originally Posted by wysota View Post
    Implement a custom QGraphicsItem.

    Now is running i drag drop from QGraphicsView and send to QGraphicsTextItem proxie..
    to insert image or so..
    And QGraphicsTextItem become 33 line to handle text from parent QAction on a simple way..

    Qt Code:
    1. void DivDiagram::TextHandler()
    2. {
    3. QColor col;
    4. QAction *invoice = qobject_cast<QAction *>(sender());
    5. const double cases = invoice->data().toDouble();
    6. QTextCursor c = QGraphicsTextItem::textCursor();
    7. QTextCharFormat format = c.charFormat();
    8. QFont f = format.font();
    9. if (cases == 0.01) {
    10. f.setBold(true);
    11. } else if (cases == 0.02) {
    12. f.setItalic(true);
    13. } else if (cases == 0.03) {
    14. f.setOverline(true);
    15. } else if (cases == 0.04) {
    16. f.setUnderline(true);
    17. } else if (cases == 0.05) {
    18. f.setStrikeOut(true);
    19. } else if (cases == 0.06) {
    20. col = QColorDialog::getRgba();
    21. if (!col.isValid()) {
    22. return;
    23. }
    24. format.setForeground(QBrush(col));
    25. } else if (cases == 0.07) {
    26. col = QColorDialog::getRgba();
    27. if (!col.isValid()) {
    28. return;
    29. }
    30. format.setBackground(QBrush(col));
    31. } else if (cases > 3) {
    32. f.setPointSizeF(cases);
    33. } else {
    34. return;
    35. }
    36. format.setFont(f);
    37. c.setCharFormat(format);
    38. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Drag & drop with model/view (Qt4)
    By yogeshm02 in forum Qt Programming
    Replies: 16
    Last Post: 19th September 2011, 20:36
  2. Problem with a cursor during Drag and Drop
    By mtrpoland in forum Qt Programming
    Replies: 1
    Last Post: 28th December 2007, 15:46
  3. Replies: 7
    Last Post: 8th September 2006, 16:19
  4. Drag and drop outside the application
    By jpn in forum Newbie
    Replies: 7
    Last Post: 27th August 2006, 15:37
  5. Drag and drop revisited
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 30th June 2006, 16:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.