#include <formwindow_widgetstack.h>
Inheritance diagram for qdesigner_internal::FormWindowWidgetStack:


Definition at line 35 of file formwindow_widgetstack.h.
Public Slots | |
| void | addTool (QDesignerFormWindowToolInterface *tool) |
| void | setCurrentTool (QDesignerFormWindowToolInterface *tool) |
| void | setCurrentTool (int index) |
| void | setSenderAsCurrentTool () |
Signals | |
| void | currentToolChanged (int index) |
Public Member Functions | |
| FormWindowWidgetStack (QWidget *parent=0) | |
| virtual | ~FormWindowWidgetStack () |
| int | count () const |
| QDesignerFormWindowToolInterface * | tool (int index) const |
| QDesignerFormWindowToolInterface * | currentTool () const |
| int | currentIndex () const |
| int | indexOf (QDesignerFormWindowToolInterface *tool) const |
| virtual QSize | sizeHint () const |
| virtual QSize | minimumSizeHint () const |
Protected Member Functions | |
| virtual void | resizeEvent (QResizeEvent *event) |
| QWidget * | defaultEditor () const |
Private Attributes | |
| QList< QDesignerFormWindowToolInterface * > | m_tools |
| int | m_current_index |
| FormWindowWidgetStack::FormWindowWidgetStack | ( | QWidget * | parent = 0 |
) |
Definition at line 36 of file formwindow_widgetstack.cpp.
References l.
00037 : QWidget(parent), 00038 m_current_index(-1) 00039 { 00040 QHBoxLayout *l = new QHBoxLayout(this); 00041 l->setMargin(0); 00042 l->setSpacing(0); 00043 }
| FormWindowWidgetStack::~FormWindowWidgetStack | ( | ) | [virtual] |
| int FormWindowWidgetStack::count | ( | ) | const |
Definition at line 49 of file formwindow_widgetstack.cpp.
References QList< T >::count(), and m_tools.
Referenced by setCurrentTool(), tool(), and qdesigner_internal::FormWindow::toolCount().
Here is the call graph for this function:

| QDesignerFormWindowToolInterface * FormWindowWidgetStack::tool | ( | int | index | ) | const |
Definition at line 171 of file formwindow_widgetstack.cpp.
References QList< T >::at(), count(), and m_tools.
Referenced by addTool(), currentTool(), indexOf(), resizeEvent(), setCurrentTool(), setSenderAsCurrentTool(), and qdesigner_internal::FormWindow::tool().
00172 { 00173 if (index < 0 || index >= count()) 00174 return 0; 00175 00176 return m_tools.at(index); 00177 }
Here is the call graph for this function:

| QDesignerFormWindowToolInterface * FormWindowWidgetStack::currentTool | ( | ) | const |
Definition at line 54 of file formwindow_widgetstack.cpp.
References m_current_index, and tool().
Referenced by qdesigner_internal::FormWindow::handleEvent(), and resizeEvent().
00055 { 00056 return tool(m_current_index); 00057 }
Here is the call graph for this function:

| int FormWindowWidgetStack::currentIndex | ( | ) | const |
Definition at line 179 of file formwindow_widgetstack.cpp.
References m_current_index.
Referenced by qdesigner_internal::FormWindow::currentTool().
00180 { 00181 return m_current_index; 00182 }
| int FormWindowWidgetStack::indexOf | ( | QDesignerFormWindowToolInterface * | tool | ) | const |
Definition at line 118 of file formwindow_widgetstack.cpp.
References QList< T >::indexOf(), m_tools, and tool().
Referenced by setCurrentTool().
Here is the call graph for this function:

| QSize FormWindowWidgetStack::sizeHint | ( | ) | const [virtual] |
Reimplemented from QWidget.
Definition at line 192 of file formwindow_widgetstack.cpp.
References defaultEditor(), and QWidget::sizeHint().
00193 { 00194 if (QWidget *editor = defaultEditor()) 00195 return editor->sizeHint(); 00196 00197 return QWidget::sizeHint(); 00198 }
Here is the call graph for this function:

| QSize FormWindowWidgetStack::minimumSizeHint | ( | ) | const [virtual] |
Reimplemented from QWidget.
Definition at line 200 of file formwindow_widgetstack.cpp.
References defaultEditor(), and QWidget::minimumSizeHint().
00201 { 00202 if (QWidget *editor = defaultEditor()) 00203 return editor->minimumSizeHint(); 00204 00205 return QWidget::minimumSizeHint(); 00206 }
Here is the call graph for this function:

| void qdesigner_internal::FormWindowWidgetStack::currentToolChanged | ( | int | index | ) | [signal] |
Referenced by setCurrentTool().
| void FormWindowWidgetStack::addTool | ( | QDesignerFormWindowToolInterface * | tool | ) | [slot] |
Definition at line 134 of file formwindow_widgetstack.cpp.
References QDesignerFormWindowToolInterface::action(), QLayout::addWidget(), QList< T >::append(), QObject::connect(), QDesignerFormWindowToolInterface::editor(), QList< T >::isEmpty(), isEmpty(), QWidget::layout(), m_tools, setSenderAsCurrentTool(), SIGNAL, SLOT, tool(), and w.
Referenced by qdesigner_internal::FormWindow::registerTool().
00135 { 00136 if (QWidget *w = tool->editor()) { 00137 w->setParent(this); 00138 00139 if (layout()->isEmpty()) 00140 layout()->addWidget(w); 00141 00142 00143 if (!m_tools.isEmpty()) // we don't hide the form editor 00144 w->hide(); 00145 } 00146 00147 m_tools.append(tool); 00148 00149 connect(tool->action(), SIGNAL(triggered()), this, SLOT(setSenderAsCurrentTool())); 00150 }
| void FormWindowWidgetStack::setCurrentTool | ( | QDesignerFormWindowToolInterface * | tool | ) | [slot] |
Definition at line 123 of file formwindow_widgetstack.cpp.
References index, indexOf(), qWarning(), and tool().
Referenced by qdesigner_internal::FormWindow::setCurrentTool(), qdesigner_internal::FormWindow::setMainContainer(), and setSenderAsCurrentTool().
00124 { 00125 int index = indexOf(tool); 00126 if (index == -1) { 00127 qWarning("FormWindowWidgetStack::setCurrentTool(): unknown tool"); 00128 return; 00129 } 00130 00131 setCurrentTool(index); 00132 }
| void FormWindowWidgetStack::setCurrentTool | ( | int | index | ) | [slot] |
Definition at line 59 of file formwindow_widgetstack.cpp.
References QDesignerFormWindowToolInterface::activated(), QList< T >::at(), count(), currentToolChanged(), QDesignerFormWindowToolInterface::deactivated(), QDesignerFormWindowToolInterface::editor(), emit, m_current_index, m_tools, qWarning(), QWidget::raise(), QWidget::rect(), tool(), and w.
00060 { 00061 if (index < 0 || index >= count()) { 00062 qWarning("FormWindowWidgetStack::setCurrentTool(): invalid index: %d", index); 00063 return; 00064 } 00065 00066 if (index == m_current_index) 00067 return; 00068 00069 if (m_current_index != -1) 00070 m_tools.at(m_current_index)->deactivated(); 00071 00072 if (m_current_index > 0) { // we don't hide the form editor 00073 QWidget *w = m_tools.at(m_current_index)->editor(); 00074 if (w != 0) 00075 w->hide(); 00076 } 00077 00078 m_current_index = index; 00079 00080 QDesignerFormWindowToolInterface *tool = m_tools.at(m_current_index); 00081 tool->activated(); 00082 QWidget *w = tool->editor(); 00083 if (w != 0) { 00084 if (w->rect() != rect()) 00085 w->setGeometry(rect()); 00086 m_tools.at(0)->editor()->raise(); 00087 w->show(); 00088 w->raise(); 00089 } 00090 00091 emit currentToolChanged(index); 00092 }
| void FormWindowWidgetStack::setSenderAsCurrentTool | ( | ) | [slot] |
Definition at line 94 of file formwindow_widgetstack.cpp.
References m_tools, qWarning(), QObject::sender(), setCurrentTool(), t, and tool().
Referenced by addTool().
00095 { 00096 QDesignerFormWindowToolInterface *tool = 0; 00097 QAction *action = qobject_cast<QAction*>(sender()); 00098 if (action == 0) { 00099 qWarning("FormWindowWidgetStack::setSenderAsCurrentTool(): sender is not a QAction"); 00100 return; 00101 } 00102 00103 foreach (QDesignerFormWindowToolInterface *t, m_tools) { 00104 if (action == t->action()) { 00105 tool = t; 00106 break; 00107 } 00108 } 00109 00110 if (tool == 0) { 00111 qWarning("FormWindowWidgetStack::setSenderAsCurrentTool(): unknown tool"); 00112 return; 00113 } 00114 00115 setCurrentTool(tool); 00116 }
| void FormWindowWidgetStack::resizeEvent | ( | QResizeEvent * | event | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter. When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().
The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.
Reimplemented from QWidget.
Definition at line 152 of file formwindow_widgetstack.cpp.
References currentTool(), QDesignerFormWindowToolInterface::editor(), QWidget::event(), QWidget::resizeEvent(), QWidget::setGeometry(), and tool().
00153 { 00154 QWidget::resizeEvent(event); 00155 00156 QRect r = QRect(0, 0, event->size().width(), event->size().height()); 00157 00158 // We always resize the widget tool 00159 QDesignerFormWindowToolInterface *widget_tool = tool(0); 00160 if (widget_tool != 0 && widget_tool->editor() != 0) 00161 widget_tool->editor()->setGeometry(r); 00162 00163 QDesignerFormWindowToolInterface *cur_tool = currentTool(); 00164 if (cur_tool == widget_tool) 00165 return; 00166 00167 if (cur_tool != 0 && cur_tool->editor() != 0) 00168 cur_tool->editor()->setGeometry(r); 00169 }
Here is the call graph for this function:

| QWidget * FormWindowWidgetStack::defaultEditor | ( | ) | const [protected] |
Definition at line 184 of file formwindow_widgetstack.cpp.
References QList< T >::at(), QDesignerFormWindowToolInterface::editor(), QList< T >::isEmpty(), and m_tools.
Referenced by minimumSizeHint(), and sizeHint().
00185 { 00186 if (m_tools.isEmpty()) 00187 return 0; 00188 00189 return m_tools.at(0)->editor(); 00190 }
Here is the call graph for this function:

QList<QDesignerFormWindowToolInterface*> qdesigner_internal::FormWindowWidgetStack::m_tools [private] |
Definition at line 66 of file formwindow_widgetstack.h.
Referenced by addTool(), count(), defaultEditor(), indexOf(), setCurrentTool(), setSenderAsCurrentTool(), and tool().
Definition at line 67 of file formwindow_widgetstack.h.
Referenced by currentIndex(), currentTool(), and setCurrentTool().
1.5.1