Qucs-GUI  0.0.18
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtabbeddockwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2006 by Gopala Krishna A <krishna.ggk@gmail.com> *
3  * *
4  * This is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2, or (at your option) *
7  * any later version. *
8  * *
9  * This software is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this package; see the file COPYING. If not, write to *
16  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, *
17  * Boston, MA 02110-1301, USA. *
18  ***************************************************************************/
19 
20 #include "vtabbeddockwidget.h"
21 #include "vtabwidget.h"
22 #include <QApplication>
23 #include <Q3MainWindow>
24 
25 VTabbedDockWidget::VTabbedDockWidget(Place p, QWidget* parent, const char* name): Q3DockWindow(p, parent, name)
26 {
27  setOrientation(Qt::Vertical);
28  m_tabWidget = 0l;
29  setCloseMode(Q3DockWindow::Always);
30 }
31 
33 {}
34 
36 {
37  Q3DockWindow::setWidget(w);
38  if(!(w->inherits("VTabWidget")))
39  return;
40  m_tabWidget = (VTabWidget*)w;
41  setResizeEnabled(false);
42  setHorizontallyStretchable(false);
43  connect(m_tabWidget,SIGNAL(widgetStackHidden()),this,SLOT(slotStackHidden()));
44  connect(m_tabWidget,SIGNAL(widgetStackShown()),this,SLOT(slotStackShown()));
45  connect(this,SIGNAL(placeChanged( Q3DockWindow::Place )),SLOT(updatePosition(Q3DockWindow::Place)));
46 }
47 
52 {
53  setFixedExtentWidth(m_tabWidget->sizeHint().width());
54  setHorizontallyStretchable(true);
55  setResizeEnabled(true);
56 }
57 
62 {
63  setFixedExtentWidth(m_tabWidget->sizeHint().width());
64  setHorizontallyStretchable(false);
65  setResizeEnabled(false);
66 }
67 
71 void VTabbedDockWidget::updatePosition(Q3DockWindow::Place p)
72 {
73  if(p==OutsideDock)
74  return;
75  if(!(qApp->mainWidget()->inherits("QMainWindow")))
76  return;
77  Q3MainWindow *mainWin = (Q3MainWindow*)(qApp->mainWidget());
78  Qt::Dock dock;
79  int ind,eo;//Not needed really
80  bool nl;//Not needed really
81 
82  bool res = mainWin->getLocation ( this, dock, ind, nl, eo );
83  if(res == false)
84  return;
85  if(dock == Qt::DockLeft)
87  else if(dock == Qt::DockRight)
89  mainWin->lineUpDockWindows();
90 }
VTabbedDockWidget(Place p=InDock, QWidget *parent=0l, const char *name=0l)
void updatePosition(Q3DockWindow::Place p)
virtual QSize sizeHint() const
Definition: vtabwidget.cpp:95
void setPosition(VTabPosition p)
Definition: vtabwidget.cpp:139
VTabWidget * m_tabWidget
virtual void setWidget(QWidget *w)