Exemple #1
0
void PTabWidget::tabChanged(int index) {
    // Hide the close button on the old tab
    if (m_lastTabIndex >= 0) {
        QAbstractButton *tabButton = qobject_cast<QAbstractButton *>(tabBar()->tabButton(m_lastTabIndex, QTabBar::LeftSide));
        if (!tabButton) {
			tabButton = qobject_cast<QAbstractButton *>(tabBar()->tabButton(m_lastTabIndex, QTabBar::RightSide));
        }

        if (tabButton) {
            tabButton->hide();
        }
    }

    m_lastTabIndex = index;

    // Show the close button on the new tab
    if (m_lastTabIndex >= 0) {
        QAbstractButton *tabButton = qobject_cast<QAbstractButton *>(tabBar()->tabButton(m_lastTabIndex, QTabBar::LeftSide));
        if (!tabButton) {
            tabButton = qobject_cast<QAbstractButton *>(tabBar()->tabButton(m_lastTabIndex, QTabBar::RightSide));
        }
        if (tabButton) {
            tabButton->show();
        }
    }
}
Exemple #2
0
void TabBar::updatePinnedTabCloseButton(int index)
{
    if (!validIndex(index)) {
        return;
    }

    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
    QAbstractButton* button = qobject_cast<QAbstractButton*>(tabButton(index, closeButtonPosition()));

    bool pinned = webTab && webTab->isPinned();

    if (pinned) {
        if (button) {
            button->hide();
        }
    }
    else {
        if (button) {
            button->show();
        }
        else {
            showCloseButton(index);
        }
    }
}
Exemple #3
0
void TabBar::updateCloseButton(int index)
{
    QAbstractButton* button = qobject_cast<QAbstractButton*>(tabButton(index, QTabBar::RightSide));
    if (!button) {
        return;
    }

    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
    if (webTab && webTab->isPinned()) {
        button->hide();
    }
    else {
        button->show();
    }
}
MainWindowController::MainWindowController(QObject *o)
{
    //mainwindow onglet community
    mainWindow = static_cast<MyIRC*>(o);
    this->inputHandler = new UserInputHandler(this);
    session = mainWindow->getSession();


    this->myChannels = new QList<Channel>();
    //list users
    QList<QString>* users = new QList<QString>;
    this->activeChan = new Channel(QString("Server"), QString("the topic"), *users);

    //la nav tab, qui contient server,chan et pvs
    navTab = new QTabWidget(this->mainWindow->getMainWindow());
    navTab->setTabsClosable(true);
    QTextEdit *serverTab = new QTextEdit(navTab);
    navTab->addTab(serverTab, "Server");

       //No close Button for this tab.
    QList<QAbstractButton*> allPButtons = navTab->findChildren<QAbstractButton*>();

    for (int ind = 0; ind < allPButtons.size(); ind++) {
        QAbstractButton* item = allPButtons.at(ind);
        if (item->inherits("CloseButton"))
            item->hide(); ; // Default "Close Tab"
    }


    outPutwin = serverTab;
    //la passer a mainwindow pour le resize event
    mainWindow->getMainWindow()->setNavTab(navTab);

    //creation de l'input de l'user
    userInputEditor = new QLineEdit(this->mainWindow->getMainWindow());
    mainWindow->getMainWindow()->setUserInput(userInputEditor);
    connect(userInputEditor, SIGNAL(returnPressed()), this->getInputHandler(), SLOT(parseInput()));
    // le paSSER A LA MAIN WINDOW POUR sLE RESIZE EVENT
    mainWindow->getMainWindow()->setUserInput(userInputEditor);

    connect(navTab , SIGNAL(currentChanged(int)),this,SLOT(onSelectedTab(int)));
    connect(navTab , SIGNAL(tabCloseRequested(int)),this,SLOT(onSelectedTab(int)));
    connect(navTab, SIGNAL(tabCloseRequested(int)), this, SLOT(onCloseTab(int)));
    //connect(navTab, SIGNAL()  void cellClicked ( int row, int column )));
  }