QT simulator symbian vs N900



  • I have the following test case which works as expected on N900. It also works using the QT simulator and Maemo Fremantle, but when using it with QT simulator + any symbian it doesn't. What I am trying to achieve with this code is to get the btTest button to appear in the top left corner of row 0, cell 0. Since I am new to QT I guess this is not how it should be done, and if so how should it be done?
    (I need this for a program where I have to make sure the table uses the biggest font size possible with all columns are visible and table never gets bigger than the screen size)

    Grumpy

    @class MainWindow : public QMainWindow
    {
    QTableWidget *qtw;
    public:
    MainWindow(QWidget *parent = 0){};
    ~MainWindow() {};
    void MakeTable(int width, int height);
    };

    void MainWindow::MakeTable(int width, int height)
    {
    QStringList hlabels, vlabels;
    hlabels << "col_1" << "col_2" << "col_3" << "col_4" << "col_5";
    vlabels << "row_1" << "row_2" << "row_3" << "row_4";
    qtw = new QTableWidget(this);
    qtw->setFont(QFont("Arial", 30));
    qtw->setRowCount(4);
    qtw->setColumnCount(5);
    qtw->setHorizontalHeaderLabels(hlabels);
    qtw->setVerticalHeaderLabels(vlabels);
    qtw->move(0,0);
    qtw->resize(width, 300);
    qtw->show();

    int frameSize = qtw->frameWidth();
    int width_hdr = qtw->verticalHeader()->width();
    int height_hdr = qtw->horizontalHeader()->height();
    
    QPushButton *btTest = new QPushButton("TEST", this);
    btTest->resize(100, 50);
    btTest->move(width_hdr + frameSize, height_hdr + frameSize);
    btTest->show();
    

    }

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.showMaximized();
    w.MakeTable(w.width(), w.height());
    return a.exec();
    }
    @



  • Try this:

    @void MainWindow::MakeTable(int width, int height)
    {
    QStringList hlabels, vlabels;
    hlabels << "col_1" << "col_2" << "col_3" << "col_4" << "col_5";
    vlabels << "row_1" << "row_2" << "row_3" << "row_4";
    qtw = new QTableWidget(this);
    qtw->setFont(QFont("Arial", 30));
    qtw->setRowCount(4);
    qtw->setColumnCount(5);
    qtw->setHorizontalHeaderLabels(hlabels);
    qtw->setVerticalHeaderLabels(vlabels);
    setCentralWidget( qtw );
    qtw->setCellWidget( 0, 0, new QPushButton("TEST", this);
    }@



  • Thanks,

    This does indeed solve to test case, but my real problem is that:
    verticalHeader()->width();
    seems to return wrong value when used with QT simulator + symbian.

    Grumpy



  • [quote author="grumpy" date="1285765474"]Thanks,

    This does indeed solve to test case, but my real problem is that:
    verticalHeader()->width();
    seems to return wrong value when used with QT simulator + symbian.

    Grumpy

    [/quote]

    Does it work fine on device. Somethings are known not to work properly on the emulator.



  • Sadly I don't have a Symbian device to test it on. Maybe I have to get one so I can make sure it works on a real device before I continue with this project.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.