QTabWidget and layout direction problem [Solved]
-
i must change layout direction because i implimented multiple
languages support in the app but when i change the layout direction
the "close buttons icons " don't follow the tabs,
if the tabwidget goes right they stay left and vise versa
here is the changing layout direction code@////after loading and installing the translator
if (language == "arabic"){
setLayoutDirection(Qt::RightToLeft);
ui->projectsTabWidget->setLayoutDirection(Qt::RightToLeft);
}
else{
setLayoutDirection(Qt::LeftToRight);
ui->projectsTabWidget->setLayoutDirection(Qt::LeftToRight);
}@here is how it looks when i change the layoutdirection
!http://i.imgur.com/sMG77vx.png(http://i.imgur.com/sMG77vx.png)!
-
it' ok isolved the problem
i noticed that when i select a tab the
"close icon " return to its place automaticly
so i eterate through all the tabs and select
them one by one each time i change the layout
direction@////save the currentindex in index
int index=ui->projectsTabWidget->currentIndex();
//iterate and select the tabs
for(int i=0;i<ui->projectsTabWidget->count()-1;i++)
ui->projectsTabWidget->setCurrentIndex(i);
//reset the selected tab
ui->projectsTabWidget->setCurrentIndex(index);@but if you know a better and a practical way,let me know