public void tabChanged(int i) { System.out.printf("i:%d\n", i); if (curIndex > -1) { map.get(curIndex).hide(); } curIndex = i; map.get(i).show(); System.out.printf("visible:%b\n", map.get(i).isVisible()); map.get(i).resize(surface.width(), surface.height()); }
public void resizeEvent(int w, int h) { tabBar.resize(w, 20); System.out.printf("resizeEvent!! %d\n", tabBar.height()); surface.move(0, tabBar.height()); surface.resize(w, height() - tabBar.height()); if (curIndex > -1) { System.out.printf("curIndex:%d\n", curIndex); map.get(curIndex).resize(surface.width(), surface.height()); } }
public TabWidget() { super(); tabBar = new QTabBar(this); surface = new QFrame(this); map = new HashMap<Integer, QWidget>(); tabBar.show(); surface.show(); tabBar.currentChanged.connect(this, "tabChanged(int)"); surface.setStyleSheet("background-color: green;"); curIndex = -1; }