[SOLVED] QTabWidget tabName and qplaintextedit::textChanged() signal problem
-
i have tried and result="hello" .
void MainWindow::on_treeView_doubleClicked(const QModelIndex &index)
{
if(index.isValid())
{
QModelIndex mapped=filter->mapToSource(index);
i=index;currentName=model->fileName(index);
sampleString=currentName;}
}
void MainWindow::text_Changed()
{
qDebug()<<sampleString; // currentName writes
ui->tabWidget_2->setTabText(ui->tabWİdget_2->currentIndex(),ty+"*");//this not working}
-
hi
u are using
currentName=model->fileName(index);
and I sort expect it to be
currentName=model->fileName(mapped);
if u still have sort on.
//
ui->tabWidget_2->setTabText(ui->tabWİdget_2->currentIndex(),ty+"*");//this not workingok. it looks strange. what are u trying to do ?
-
@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 ?
-
@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 ? -
@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 -
@takoo
hi
you create a new version of main window hereplaint::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. ?