Results 1 to 5 of 5

Thread: QFrame problem

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

    Default QFrame problem

    Hi,
    I have defined a QFrame item in one class "frameH"
    and I want to "show" this frame in another class
    In the first class I have
    Qt Code:
    1. signals:
    2. void showFrame(QFrame);
    To copy to clipboard, switch view to plain text mode 
    and
    Qt Code:
    1. emit showFrame(frameH);
    To copy to clipboard, switch view to plain text mode 
    and in the second class I have
    Qt Code:
    1. connect(pb1Functions, SIGNAL(showFrame(QFrame)), this, SLOT(slotShowFrame(QFrame)));
    To copy to clipboard, switch view to plain text mode 
    and
    Qt Code:
    1. void slotShowFrame(QFrame H) { H.show(); }
    To copy to clipboard, switch view to plain text mode 
    and when compiling I get
    bp1.cpp:51:error no matching function for call to 'PB1::showFrame(QFrame*&)'
    bp1.h:51:note:canadates are: void PB1::showFrame(QFrame)
    I am totally confused as what the code should actually look like in each class.
    Thanks

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFrame problem

    Change the signal and slot definitions to take a QFrame*& parameter. Also modify the connect call accordingly.
    Is frameH QFrame* or QFrame*&?

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QFrame problem

    It should be QFrame* (a pointer to QFrame instance) in signal and slot declarations and in the connect() statement.
    J-P Nurmi

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

    Default Re: QFrame problem

    OK, with your help, I have been able to display/turn 0ff my "helpFrame" on top of the "painter" items, but the frame has a title bar at the top which I don't want and and it changes the color o the application title, also I am unable to change the color of the QTextEdit widget.(see attachment)

    I have a feeling I am going about this all wrong. I want the Layout I have and I want the "helpBox" on top of the drawing.
    Qt Code:
    1. #include "baseform.h"
    2. #include "pb1.h"
    3. PB1::PB1 ( QWidget *parent ) : QWidget(parent)
    4. {
    5. frameH = new QFrame();
    6. frameH->setAutoFillBackground ( true );
    7. frameH->setFrameShape ( QFrame::StyledPanel );
    8. frameH->setFrameShadow ( QFrame::Raised );
    9. frameH->setPalette(QColor(200, 200, 200));
    10. teHBox = new QTextEdit ( frameH );
    11. teHBox->setGeometry ( 10, 10, 330, 410 );
    12. teHBox->setReadOnly(true);
    13. }
    14. ///===================================================end of constructor
    15. void PB1::slotPb1Functions()
    16. {
    17. static bool flag = false;
    18. if(flag == false)
    19. {
    20. emit getDrawingFrameSize(&W, &H);
    21. frameH->setGeometry(W - 350, H - 420, 350, 430);
    22. emit getTextListItem(2, &k);
    23. teHBox->setPlainText(k);
    24. emit showFrame(frameH);
    25. flag = true;
    26. }
    27. else
    28. {
    29. emit hideFrame(frameH);
    30. flag = false;
    31. }
    32. }
    To copy to clipboard, switch view to plain text mode 
    I've gone through the examples and demos but have not found one that does exactly what I want to do.
    I would appreciate any help
    Thanks
    pete

    I noticed the attachment does not show all the lines near the upper right corner, but they are there on the original.
    Attached Images Attached Images
    Last edited by impeteperry; 22nd February 2008 at 06:44.

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

    Default Re: QFrame problem

    OK, I'm back.
    I will restate my problem in SIMPLE terms.
    1. I have a "painter" widget on which I can draw and edit lines and text.
    2. I have a "puhbutton" with a "QLabel" over it. I want to use either of these two to toggle on/off a "message" box to display various "help" messages.
    3. I want these "boxes" to look like the one in the attachment, but I want it to lie on top of the "painter", not as shown in the attachment
    4. I would appreciate the location of a tutorial or example that does just this and not a lot of additional stuff;

    I went through all the /usr/local/Trolltech/Qt-4.3.3 demos and examples for help. The only on that even came close was the "imagecomposition" example. This is done in "compositionMode" which is restricted to "png" images.

    I am struggling to re-write a "Vertically integrated, parametric driven, graphic program" that I had written before "DOS" for the precast concrete industry .
    With this type of Format, the learning curve for usage should be less then an afternoon.

    I would appreciate any help
    Pete
    Attached Images Attached Images

Similar Threads

  1. Using a QFrame as a color selection indicator
    By KShots in forum Qt Tools
    Replies: 8
    Last Post: 14th June 2011, 23:55
  2. Qpainter function on a QFrame problem
    By impeteperry in forum Newbie
    Replies: 45
    Last Post: 14th October 2008, 12:43
  3. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  4. QTabWidget Parenting Problem
    By mclark in forum Newbie
    Replies: 4
    Last Post: 18th January 2007, 15:20
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.