🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.c
Article #309783

Qt, Control+Tab

#309783
From: Borneq
Date: Sun, 30 Dec 2018 21:45
41 lines
2042 bytes
Chciałem zmienić działanie Control+Tab, aby można było przechodzić 
szybko do ostatnio wybranej zakładki.
Poprzez wstawianie jej na początek:
https://forum.qt.io/topic/98081/how-programically-order-tabs-in-qtabwidget

Mam
void TabWindow::keyReleaseEvent(QKeyEvent *event)
{
     if (event->key()==Qt::Key_Control)
     {
         std::cout <<  "release" << std::endl;
         CodeEditor *current = qobject_cast<CodeEditor 
*>(tabWidget->currentWidget());
         tabWidget->removeTab(tabWidget->currentIndex());
         tabWidget->insertTab(0, current, current->name);
         tabWidget->setCurrentWidget(current);
     }
}

Ale chyba źle, bo jest

void QLayout::removeWidget(QWidget *widget)
{
     int i = 0;
     QLayoutItem *child;
     while ((child = itemAt(i))) {
         if (child->widget() == widget) {
             delete takeAt(i);
             invalidate();
         } else {
             ++i;
         }
     }
}

zwalnia wskaźnik przy RemoveTab, choć u mnie wersja Debug działa i nie 
wykrzacza się, to widać że tak nie robić.
ALE
W Qt creatorze jest to rozwiązane: dla Control+Tab pokazuje się lista i 
najnowsze brane są na początek.
Tylko jako to oprogramować ?
Technical Details
Message-ID: <q0bea6$tfc$1@node1.news.atman.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From: Borneq <borneq@antyspam.hidden.pl>
Newsgroups: pl.comp.lang.c
Subject: Qt, Control+Tab
Date: Sun, 30 Dec 2018 22:45:44 +0100
Organization: ATMAN - ATM S.A.
Lines: 41
Message-ID: <q0bea6$tfc$1@node1.news.atman.pl>
NNTP-Posting-Host: public-gprs360017.centertel.pl
Mime-Version: 1.0
X-Trace: node1.news.atman.pl 1546206342 30188 37.47.37.146 (30 Dec 2018 21:45:42 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Sun, 30 Dec 2018 21:45:42 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0
X-Mozilla-News-Host: news://news.atman.pl:119
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit