PDA

View Full Version : QFrame problem



impeteperry
14th February 2008, 15:54
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
signals:
void showFrame(QFrame);
and
emit showFrame(frameH);and in the second class I have
connect(pb1Functions, SIGNAL(showFrame(QFrame)), this, SLOT(slotShowFrame(QFrame)));and
void slotShowFrame(QFrame H) { H.show(); }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

marcel
14th February 2008, 16:07
Change the signal and slot definitions to take a QFrame*& parameter. Also modify the connect call accordingly.
Is frameH QFrame* or QFrame*&?

jpn
14th February 2008, 16:17
It should be QFrame* (a pointer to QFrame instance) in signal and slot declarations and in the connect() statement.

impeteperry
22nd February 2008, 06:29
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.
#include "baseform.h"
#include "pb1.h"
PB1::PB1 ( QWidget *parent ) : QWidget(parent)
{
frameH = new QFrame();
frameH->setAutoFillBackground ( true );
frameH->setFrameShape ( QFrame::StyledPanel );
frameH->setFrameShadow ( QFrame::Raised );
frameH->setPalette(QColor(200, 200, 200));
teHBox = new QTextEdit ( frameH );
teHBox->setGeometry ( 10, 10, 330, 410 );
teHBox->setReadOnly(true);
}
///================================================== =end of constructor
void PB1::slotPb1Functions()
{
static bool flag = false;
if(flag == false)
{
emit getDrawingFrameSize(&W, &H);
frameH->setGeometry(W - 350, H - 420, 350, 430);
emit getTextListItem(2, &k);
teHBox->setPlainText(k);
emit showFrame(frameH);
flag = true;
}
else
{
emit hideFrame(frameH);
flag = false;
}
}
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.

impeteperry
23rd February 2008, 20:34
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