Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]Can`t display QTextEdit in my application
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Can`t display QTextEdit in my application

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    heatblazer
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • H Offline
        H Offline
        heatblazer
        wrote on last edited by
        #3

        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]

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Were your QPushButtons allocated on the heap ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved