[Interest] Need help

Jason H scorp1us at yahoo.com
Wed May 9 17:16:37 CEST 2012


Honestly I'd cheat and lay it our in a UI, then take the UIC code, or just use the UI file, starting with all initially hidden and when they hit the button, unhide one.
Assuming of course there is a reasonable max of columns.



________________________________
 From: Sujan Dasmahapatra <sdh at lmwindpower.com>
To: interest at qt-project.org 
Sent: Wednesday, May 9, 2012 2:31 AM
Subject: [Interest] Need help
 

 
Please give me some suggestions I am stuck in this problem.
I want to implement a set of QTextEdit in 2 columns and multiple rows.
Initially my sheet(QWIdget) will be blank, There will be a button at the top
when pressing this button, a QTextEdit should be added on the sheet at row=0,
column=0. Then again when button pressed another QTextEdit should be added at
row=0, column=1.
Then when again pressed QTextEdit will be added at row=1, column=0
Then when again pressed QTextEdit will be added at row=1, column=1…..and
so on.
 
QTextEdit size should be ½ of sheet width and ½ of sheet
height. When resizing they should be resized accordingly.
 
Please give me a working code so that I can compile and
understand. Thanks a lot for any help.
 
Please see my snippet.
 
CSheet::CSheet(QWidget *parent):QWidget(parent)
{
                addChartPB = new QPushButton(“Add
chart”,this);
                addChartPB->setGeometry(5,5,100,25);
                addChartPB->setFixedSize(100,25);
                connect(addChartPB, SIGNAL(clicked()),this,
SLOT(addChart()));
                addChartPB->show();
 
                canvas = new QWIdget(this);
                canvas->setGeometry(5,35,width()-10,height()-40);
                canvas->show();
                
                layoutV = new QVBoxLayout(this);
                layoutV->addWidget(addChartPB);
                layout->addWidget(canvas);
                setLayout(layoutV);
 
                gridLayout = new QGridLayout(canvas)
                canvas->setLayout(gridLayout);
}
 
CSheet::addChart()
{
//I don’t know how should I implement the add button
Please help…
}
 
 
 
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120509/db1a6fd6/attachment.html>


More information about the Interest mailing list