0

I have always been wondering whether the special "+" tab used to add other tabs (as in internet browsers) had a special name.

Also, is there any popular framework (Qt, wxWidgets, etc...) that has a built-in feature for that in its Notebook/TabWidget?

EDIT: Some asked why would such a feature exist while it's simple to implement it. Well, the answer is simple: every widely used feature deserve a dedicated component. It may be simple to implement in a classic tab widget, but it becames harder to do when we can move the tabs (this special one should always be the last) or when it's possible to close the tabs without having to have them selected (in some tab widgets, there's a cross to close the tab on every tab). Well, considering the different frameworks, it may be simpler or harder to implement. Hence this question to know whether the feature is standard enough to have a dedicated name and some "built-in" implementations in some frameworks :)

Morwenn
  • 21,684
  • 12
  • 93
  • 152
  • No, why should it be ready if it's so simple to implement? – Blood Feb 07 '13 at 23:00
  • The question could be asked for many widgets. Just because stuff that are often use deserve to have something ready for them. There are some restrictions to this: you don't want to be able to close it, nor do you want to have that "+" at another place than the last one in tabs :) – Morwenn Feb 07 '13 at 23:25
  • It really doesn't make sense to choose a GUI framework based on whether or not there's an "add tab" button. – Anthony Feb 08 '13 at 12:14
  • Did I ever say I was choosing anything? It's just some random question, without any link to anything I'm doing or wanting to do. It's just for the sake of mind satisfaction :p – Morwenn Feb 08 '13 at 19:03

2 Answers2

2

As for current versions of WPF, Winform and Qt there is not any tab control with such a feature, but it could be added easily. check links for similar examples in WPF and Winform.

Community
  • 1
  • 1
sjtaheri
  • 4,409
  • 3
  • 19
  • 15
  • 1
    Well. Since noone gave other answers, I will admit there is nothing implementing that feature right now and it has no name. I am a little disappointed but if it can't be helped if it does not exist :) – Morwenn Feb 13 '13 at 21:28
2

With Qt you can use code like this:

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(changedTab(int)));
}

void MainWindow::changedTab(int tabId) {
    if (tabId == ui->tabWidget->count() - 1) {
        QWidget *newTab = new QWidget;
        ui->tabWidget->insertTab(tabId, newTab, "new label");
        ui->tabWidget->setCurrentIndex(tabId);
    }
}

For close tab see setTabsClosable()

asclepix
  • 7,971
  • 3
  • 31
  • 41