[SOLVED]Can`t display QTextEdit in my application



  • Hello, I am trying to show a text field in my program which is realtive to the main window.But somehow it does not appear. Here is code I am using:
    @
    QTextEdit textArea(QString("BLA BLA BLA"));
    textArea.setMinimumSize(myFrame->geometry().width()* TEXT_AREA_WRATIO,
    myFrame->geometry().height()* TEXT_AREA_HRATIO);
    textArea.setEnabled(true);

    lFactory->verticalLayouts.at(1)->addWidget(animationWindow
                                                 ->getView());
    lFactory->verticalLayouts.at(1)->addWidget(&textArea,
                                               Qt::AlignBottom);
    
    lFactory->horizontalLayouts.at(0)->addWidget(back, Qt::AlignLeft);
    lFactory->horizontalLayouts.at(0)->addWidget(next, Qt::AlignRight);
    
    lFactory->verticalLayouts.at(0)->addLayout(
                lFactory->verticalLayouts.at(1));
    
    lFactory->verticalLayouts.at(1)->addLayout(
                lFactory->horizontalLayouts.at(0));
    
    myFrame->setLayout(lFactory->verticalLayouts.at(0));
    

    @
    Everything is shown, the GraphicsView, and the 2 buttons. QTextEdit is missing.


  • Lifetime Qt Champion

    Hi,

    I guess this happens in your constructor, right ? Anyway, textArea is a local variable that will be destroyed at the end of the function thus you won't see it.

    Hope it helps



  • Thanks. It was the cause of it. But... I had the local variables for the both back and next QPushButtons, that were displayed correctly... No matter, I wont dig in. Its solved. Thank you very much.
    [quote author="SGaist" date="1419458294"]Hi,

    I guess this happens in your constructor, right ? Anyway, textArea is a local variable that will be destroyed at the end of the function thus you won't see it.

    Hope it helps[/quote]


  • Lifetime Qt Champion

    Were your QPushButtons allocated on the heap ?


Log in to reply
 

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