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] QTabWidget tabName and qplaintextedit::textChanged() signal problem

[SOLVED] QTabWidget tabName and qplaintextedit::textChanged() signal problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
qplaintexteditqstringqtabwidget
31 Posts 3 Posters 9.7k Views
  • 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.
  • T takoo

    setTabText not working in addStar function. normally works(setTabText())

    mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #12

    @takoo
    Hi
    It should do the same in any slot or function.
    Are you sure its called
    and the index and text you use are valid?
    what did
    qDebug () << "sel is:" << sel;
    show you?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      takoo
      wrote on last edited by
      #13

      sel = -1

      I just write code ------- (-_-) ----------

      mrjjM 1 Reply Last reply
      0
      • T takoo

        sel = -1

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #14

        @takoo
        ok. ahh.
        so index is not valid.
        tabWİdget_2->currentIndex() is -1 which means there is no
        current/active tab.
        try clicking tab before testing the text changed or change to
        the first one.

        How many tabs did u add to it ?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          takoo
          wrote on last edited by
          #15

          I am add tab with code. So It's not certain tabcount. Index only not valid in textChanged(). Otherwise valid

          I just write code ------- (-_-) ----------

          1 Reply Last reply
          0
          • T Offline
            T Offline
            takoo
            wrote on last edited by
            #16

            ui->tabWidget_2->setTabText(0,"tabOne"); I tried it in addStar() function but not working

            I just write code ------- (-_-) ----------

            mrjjM 1 Reply Last reply
            0
            • T takoo

              ui->tabWidget_2->setTabText(0,"tabOne"); I tried it in addStar() function but not working

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #17

              @takoo
              sorry I am out of guesses.
              if
              ui->tabWidget_2->setTabText(0,"tabOne");
              does not work, it have no idea then.

              Did u place break point on it and made sure its called?
              You are 100% sure you are adding tabs to ui->tabWidget_2 and not
              ui->tabWidget_1 or something else ?

              1 Reply Last reply
              0
              • T Offline
                T Offline
                takoo
                wrote on last edited by
                #18

                I am sure

                I just write code ------- (-_-) ----------

                mrjjM 1 Reply Last reply
                0
                • T takoo

                  I am sure

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #19

                  @takoo
                  Well i'm out of guesses. sorry.
                  There is no reason that setTabText should not work.

                  please see this small sample that change tabtext when u write in edit
                  https://www.dropbox.com/s/pm5uolmc7m0fo2w/mytabs.zip?dl=0

                  1 Reply Last reply
                  1
                  • T Offline
                    T Offline
                    takoo
                    wrote on last edited by
                    #20

                    @mrjj I've identified problem. not see anything about qTabWidget in function textChanged()

                    I just write code ------- (-_-) ----------

                    mrjjM 1 Reply Last reply
                    0
                    • T takoo

                      @mrjj I've identified problem. not see anything about qTabWidget in function textChanged()

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #21

                      @takoo
                      Ok, im sure what u changed?

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        takoo
                        wrote on last edited by
                        #22

                        i sent scripts. You can see

                        I just write code ------- (-_-) ----------

                        mrjjM 1 Reply Last reply
                        0
                        • T takoo

                          i sent scripts. You can see

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #23

                          @takoo
                          Ohh, the function was empty??

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            takoo
                            wrote on last edited by
                            #24

                            @mrjj Nothing happens when I wrote related qtabwidget in that function(addStar)

                            I just write code ------- (-_-) ----------

                            1 Reply Last reply
                            0
                            • T Offline
                              T Offline
                              takoo
                              wrote on last edited by
                              #25

                              @mrjj http://www116.zippyshare.com/v/M9f6gXaM/file.html
                              Try to run this project (myTabs)

                              I just write code ------- (-_-) ----------

                              mrjjM 1 Reply Last reply
                              0
                              • T takoo

                                @mrjj http://www116.zippyshare.com/v/M9f6gXaM/file.html
                                Try to run this project (myTabs)

                                mrjjM Offline
                                mrjjM Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on last edited by mrjj
                                #26

                                @takoo
                                hi
                                you create a new version of main window here

                                plaint::plaint(QWidget *parent):QPlainTextEdit(parent)
                                {
                                  mw=new MainWindow();<<---------------- new main wind
                                  connect(this,SIGNAL(textChanged()),mw,SLOT(yildiz()));
                                }
                                

                                mw is never shown and u never see u change the tabtext in this new version you create.

                                in main.cpp, you already create a Mainwindow version so not sure why u create a new one. ?

                                1 Reply Last reply
                                0
                                • T Offline
                                  T Offline
                                  takoo
                                  wrote on last edited by
                                  #27

                                  @mrjj hi
                                  exactly what I need to do ?

                                  I just write code ------- (-_-) ----------

                                  mrjjM 1 Reply Last reply
                                  0
                                  • T takoo

                                    @mrjj hi
                                    exactly what I need to do ?

                                    mrjjM Offline
                                    mrjjM Offline
                                    mrjj
                                    Lifetime Qt Champion
                                    wrote on last edited by mrjj
                                    #28

                                    @takoo
                                    well It really depends what u want ?
                                    Im not sure why you have
                                    class plaint:public QPlainTextEdit
                                    Instead of just using QPlainTextEdit directly ?

                                    update:
                                    i fixed the sample to do what u talked about first.
                                    To change the tabtext for the tab.
                                    https://www.dropbox.com/s/eezslmryro6ptrj/mytabs.zip?dl=0

                                    1 Reply Last reply
                                    0
                                    • T Offline
                                      T Offline
                                      takoo
                                      wrote on last edited by
                                      #29

                                      @mrjj thanks :D Solved

                                      I just write code ------- (-_-) ----------

                                      mrjjM 1 Reply Last reply
                                      0
                                      • T takoo

                                        @mrjj thanks :D Solved

                                        mrjjM Offline
                                        mrjjM Offline
                                        mrjj
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #30

                                        @takoo
                                        So all came from u had 2 windows but the second was never shown so
                                        it seem that nothing happened. :)
                                        code help for me to undestand, so good idea :)

                                        1 Reply Last reply
                                        0
                                        • T Offline
                                          T Offline
                                          takoo
                                          wrote on last edited by
                                          #31

                                          @mrjj that is right :D

                                          I just write code ------- (-_-) ----------

                                          1 Reply Last reply
                                          1

                                          • Login

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