Results 1 to 20 of 46

Thread: Qpainter function on a QFrame problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qpainter function on a QFrame problem

    You see... the problem is we are not seeing your problem I suggest you forget about F keys and all that stuff and focus on implementing a widget with properties that allow you to modify the behaviour of the widget. When you have that done, start thinking about function keys.

  2. #2
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Qpainter function on a QFrame problem

    Thanks for your suggestion, but I'm afraid you are missing the point of my program.
    I am an engineer and innovator in the building industry. I have had 2 growing problems with the computer industry over the past 35 years. The complexity of the user interface (look at Blender) and the CAD programs in principle

    This may not be the proper forum for a discussion of this type. Please let me know if it is oK or suggest another Qt forum .

    Thasks
    pete perry

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

    Default Re: Qpainter function on a QFrame problem

    Quote Originally Posted by impeteperry View Post
    Thanks for your suggestion, but I'm afraid you are missing the point of my program.
    I'm not. You're missing the point of your problem. You have problems with drawing, not with input events. That's why I say to make your widget draw in a predictable, reproducable and desirable way and only then add value to it, not the other way round.

    I am an engineer and innovator in the building industry. I have had 2 growing problems with the computer industry over the past 35 years. The complexity of the user interface (look at Blender) and the CAD programs in principle

    This may not be the proper forum for a discussion of this type. Please let me know if it is oK or suggest another Qt forum .
    Please don't insult us. You know nothing of us or problems we are dealing with. At the same time you are asking for help with your problem, not the other way round.

    As for one of your questions - switching to Qt4 is a good idea in general, especially that it will probably force or encourage you to do it the right way - using QGraphicsView and not drawing directly inside a frame. You should have used QCanvas...

    Your code cries: refactor me! But what do I know.... I'm not dealing with problems complex enough to know anything about yours...

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

    impeteperry (31st March 2008)

  5. #4
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Qpainter function on a QFrame problem

    Sir, I am not insulting you, Qt or anybody else. I appreciate your effort to help me. so enough of that!

    I thought the forum was for help on my problems using your product rather then the other way around.

    The use of the "function/accelerator keys" for program control rather then the mouse is part and parcel of what I am trying to develop, right or wrong.

    My problem is "I can show a "Help widget" on a painter by pressing a function key, but I can't delete it by pressing a function key". My Question is "what code to I need to add to my "help Widget to correct this problem"?

    I see that Qt 4 no longer lists QCanvas, however I shall go back to square one, look at QGraphicView and see if I an do in Qt what I did in DOS.

    Again, I am sorry if I offended you in any way, sometimes I don't express myself to well.

    Thanks

    I went to "examples" for QGraphicview and found collindingmice. Oh what a delightful examole!!!
    I see there is layering there. Let you know how I make out.

    Thanks again,
    Last edited by impeteperry; 31st March 2008 at 20:25.

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

    Default Re: Qpainter function on a QFrame problem

    Quote Originally Posted by impeteperry View Post
    The use of the "function/accelerator keys" for program control rather then the mouse is part and parcel of what I am trying to develop, right or wrong.
    But that's not the issue here. If you have other things working, adding accelerators is trivial. If something doesn't work, it means the problem is elsewhere.

    My problem is "I can show a "Help widget" on a painter by pressing a function key, but I can't delete it by pressing a function key". My Question is "what code to I need to add to my "help Widget to correct this problem"?
    You need to implement a paint event correctly, so that it takes into consideration the help widget. I'd add a property holding the help text to show and when the text is empty, hide the help and otherwise render the text. Something like:

    Qt Code:
    1. class MyClass: public ... {
    2. Q_OBJECT
    3. Q_PROPERTY(QString helpText READ helpText WRITE setHelpText)
    4. public:
    5. //...
    6. const QString &helpText() const { return m_helpText; }
    7. public slots:
    8. void setHelpText(const QString &txt) {
    9. if(txt==m_helpText) return;
    10. m_helpText = txt;
    11. update();
    12. }
    13. void clearHelpText() { setHelpText(QString::null); }
    14. protected:
    15. void paintEvent(...){
    16. QPainter p(this);
    17. //...
    18. if(!m_helpText.isEmpty()){
    19. p.save();
    20. //...
    21. p.drawRect(...);
    22. p.drawText(...);
    23. p.restore();
    24. }
    25. }
    26. };
    To copy to clipboard, switch view to plain text mode 

    Actually I'd use QCanvas or QGraphicsView...

  7. #6
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Qpainter function on a QFrame problem

    Taking your advice, I am looking at QGraphicView-scene. As I said, I would start from scratch. This looks promising.

    Being a bit mentally retarded at 82 and in need of an eye operation it will take a bit of time.

    I am a little leery of QCanvas as it is no longer listed in the Qt documentation under "all classes". (I did some stuff with it under Qt 3).

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qpainter function on a QFrame problem

    QCanvas and QGraphicsView are very similar. There's even an article written by Andreas on QQ on porting QCanvas applications to Graphics View.

  9. #8
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Qpainter function on a QFrame problem

    I'm confused. If QCanvas is not listed Qt4, do you mean go back to Qt3 or that If I worked in QCanvas in Qt3, I should not have any problem with QGraphicsview in Qt 4?

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

    Default Re: Qpainter function on a QFrame problem

    I mean use Qt4 and GV.

Similar Threads

  1. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  2. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  3. Problem emitting signal from a static function
    By Valheru in forum Qt Programming
    Replies: 21
    Last Post: 12th June 2007, 14:48
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  5. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52

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.