[SOLVED] QTabWidget tabName and qplaintextedit::textChanged() signal problem
-
Hi,
What is text_Changed ? If it's a slot, how is it connected ?
-
hi
connect(ui->plainTextEdit,SIGNAL(textChanged()),this,SLOT(addStar()));
This connects to addStar() and not
text_Changed() ?
also , to make sure connect works, you can
QDebug() << " Text Change Signal:" << connect(ui->plainTextEdit,SIGNAL(textChanged()),this,SLOT(addStar()));
and see it returns true. -
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