#include <connectionedit_p.h>
Inheritance diagram for qdesigner_internal::ConnectionEdit:


Definition at line 144 of file connectionedit_p.h.
enum qdesigner_internal::ConnectionEdit::State [protected] |
| qdesigner_internal::ConnectionEdit::ConnectionEdit | ( | QWidget * | parent, | |
| QDesignerFormWindowInterface * | form | |||
| ) |
Definition at line 921 of file connectionedit.cpp.
References Qt::blue, Qt::ClickFocus, QObject::connect(), form(), m_active_color, m_bg_widget, m_enable_update_background, m_inactive_color, m_start_connection_on_drag, m_tmp_con, m_undo_stack, m_widget_under_mouse, Qt::red, QWidget::setAttribute(), QWidget::setFocusPolicy(), SIGNAL, SLOT, Qt::WA_MouseTracking, and widgetRemoved().
00922 : QWidget(parent) 00923 { 00924 m_bg_widget = 0; 00925 m_widget_under_mouse = 0; 00926 m_tmp_con = 0; 00927 m_start_connection_on_drag = true; 00928 m_enable_update_background = false; 00929 m_undo_stack = form->commandHistory(); 00930 m_active_color = Qt::red; 00931 m_inactive_color = Qt::blue; 00932 setAttribute(Qt::WA_MouseTracking, true); 00933 setFocusPolicy(Qt::ClickFocus); 00934 00935 connect(form, SIGNAL(widgetRemoved(QWidget*)), this, SLOT(widgetRemoved(QWidget*))); 00936 }
Here is the call graph for this function:

| QWidget* qdesigner_internal::ConnectionEdit::background | ( | ) | const [inline] |
Definition at line 150 of file connectionedit_p.h.
Referenced by qdesigner_internal::BuddyEditor::setBackground(), setBackground(), qdesigner_internal::SignalSlotEditor::toUi(), and qdesigner_internal::BuddyEditor::updateBackground().
00150 { return m_bg_widget; }
| void qdesigner_internal::ConnectionEdit::setSelected | ( | Connection * | con, | |
| bool | sel | |||
| ) |
Definition at line 1331 of file connectionedit.cpp.
References connectionSelected(), QMap< Key, T >::contains(), emit, QMap< Key, T >::insert(), m_sel_con_set, QMap< Key, T >::remove(), and qdesigner_internal::Connection::update().
Referenced by qdesigner_internal::BuddyEditor::deleteSelected(), qdesigner_internal::BuddyEditor::endConnection(), mousePressEvent(), qdesigner_internal::AddConnectionCommand::redo(), qdesigner_internal::DeleteConnectionsCommand::redo(), qdesigner_internal::DeleteConnectionsCommand::undo(), qdesigner_internal::AddConnectionCommand::undo(), and qdesigner_internal::BuddyEditor::widgetRemoved().
01332 { 01333 if (!con || sel == m_sel_con_set.contains(con)) 01334 return; 01335 01336 if (sel) { 01337 m_sel_con_set.insert(con, con); 01338 emit connectionSelected(con); 01339 } else { 01340 m_sel_con_set.remove(con); 01341 } 01342 01343 con->update(); 01344 }
Here is the call graph for this function:

| bool qdesigner_internal::ConnectionEdit::selected | ( | const Connection * | con | ) | const |
Definition at line 1346 of file connectionedit.cpp.
References QMap< Key, T >::contains(), and m_sel_con_set.
Referenced by endPointAt(), mousePressEvent(), paintConnection(), paintEvent(), and paintLabel().
01347 { 01348 return m_sel_con_set.contains(const_cast<Connection*>(con)); 01349 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::selectNone | ( | ) |
Definition at line 1351 of file connectionedit.cpp.
References QMap< Key, T >::clear(), m_sel_con_set, and qdesigner_internal::Connection::update().
Referenced by qdesigner_internal::BuddyEditor::endConnection(), mousePressEvent(), and qdesigner_internal::AddConnectionCommand::redo().
01352 { 01353 foreach (Connection *con, m_sel_con_set) 01354 con->update(); 01355 01356 m_sel_con_set.clear(); 01357 }
Here is the call graph for this function:

| int qdesigner_internal::ConnectionEdit::connectionCount | ( | ) | const [inline] |
Definition at line 156 of file connectionedit_p.h.
Referenced by qdesigner_internal::ConnectionModel::connectionChanged(), qdesigner_internal::ConnectionModel::data(), qdesigner_internal::ConnectionModel::index(), qdesigner_internal::ConnectionModel::indexToConnection(), qdesigner_internal::ConnectionModel::rowCount(), qdesigner_internal::SignalSlotEditor::toUi(), qdesigner_internal::BuddyEditor::updateBackground(), and qdesigner_internal::BuddyEditor::widgetAt().
00156 { return m_con_list.size(); }
| Connection* qdesigner_internal::ConnectionEdit::connection | ( | int | i | ) | const [inline] |
Definition at line 157 of file connectionedit_p.h.
Referenced by qdesigner_internal::ConnectionModel::connectionChanged(), qdesigner_internal::ConnectionModel::data(), qdesigner_internal::ConnectionModel::indexToConnection(), qdesigner_internal::ConnectionModel::setData(), qdesigner_internal::SignalSlotEditor::toUi(), qdesigner_internal::BuddyEditor::updateBackground(), and qdesigner_internal::BuddyEditor::widgetAt().
00157 { return m_con_list.at(i); }
| int qdesigner_internal::ConnectionEdit::indexOfConnection | ( | Connection * | con | ) | const [inline] |
Definition at line 158 of file connectionedit_p.h.
Referenced by qdesigner_internal::ConnectionModel::aboutToRemoveConnection(), qdesigner_internal::ConnectionModel::connectionChanged(), qdesigner_internal::ConnectionModel::connectionToIndex(), qdesigner_internal::DeleteConnectionsCommand::redo(), and qdesigner_internal::AddConnectionCommand::undo().
00158 { return m_con_list.indexOf(con); }
| void qdesigner_internal::ConnectionEdit::deleteSelected | ( | ) | [virtual] |
Definition at line 1419 of file connectionedit.cpp.
References DeleteConnectionsCommand, QMap< Key, T >::isEmpty(), QMap< Key, T >::keys(), m_sel_con_set, m_undo_stack, and QUndoStack::push().
Referenced by keyPressEvent().
01420 { 01421 if (m_sel_con_set.isEmpty()) 01422 return; 01423 m_undo_stack->push(new DeleteConnectionsCommand(this, m_sel_con_set.keys())); 01424 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::setSource | ( | Connection * | con, | |
| const QString & | obj_name | |||
| ) | [virtual] |
Definition at line 1443 of file connectionedit.cpp.
References m_bg_widget, m_undo_stack, object, qdesigner_internal::Connection::object(), QUndoStack::push(), and SetEndPointCommand.
Referenced by qdesigner_internal::SignalSlotEditor::setSource().
01444 { 01445 QObject *object = qFindChild<QObject*>(m_bg_widget, obj_name); 01446 if (object == 0 && m_bg_widget->objectName() == obj_name) 01447 object = m_bg_widget; 01448 01449 if (object == con->object(EndPoint::Source)) 01450 return; 01451 01452 m_undo_stack->push(new SetEndPointCommand(this, con, EndPoint::Source, object)); 01453 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::setTarget | ( | Connection * | con, | |
| const QString & | obj_name | |||
| ) | [virtual] |
Definition at line 1455 of file connectionedit.cpp.
References m_bg_widget, m_undo_stack, object, qdesigner_internal::Connection::object(), QUndoStack::push(), and SetEndPointCommand.
Referenced by qdesigner_internal::SignalSlotEditor::setTarget().
01456 { 01457 QObject *object = qFindChild<QObject*>(m_bg_widget, obj_name); 01458 if (object == 0 && m_bg_widget->objectName() == obj_name) 01459 object = m_bg_widget; 01460 01461 if (object == con->object(EndPoint::Target)) 01462 return; 01463 01464 m_undo_stack->push(new SetEndPointCommand(this, con, EndPoint::Target, object)); 01465 }
Here is the call graph for this function:

| QUndoStack* qdesigner_internal::ConnectionEdit::undoStack | ( | ) | const [inline] |
Definition at line 165 of file connectionedit_p.h.
Referenced by qdesigner_internal::SignalSlotEditor::addEmptyConnection(), qdesigner_internal::BuddyEditor::deleteSelected(), qdesigner_internal::BuddyEditor::endConnection(), qdesigner_internal::SignalSlotEditor::setSignal(), qdesigner_internal::SignalSlotEditor::setSlot(), qdesigner_internal::SignalSlotEditor::setSource(), qdesigner_internal::SignalSlotEditor::setTarget(), and qdesigner_internal::BuddyEditor::widgetRemoved().
00165 { return m_undo_stack; }
| void qdesigner_internal::ConnectionEdit::clear | ( | ) |
Definition at line 939 of file connectionedit.cpp.
References QMap< Key, T >::clear(), QList< T >::clear(), m_bg_widget, m_con_list, m_sel_con_set, m_tmp_con, and m_widget_under_mouse.
Referenced by qdesigner_internal::BuddyEditor::setBackground().
00940 { 00941 m_con_list.clear(); 00942 m_sel_con_set.clear(); 00943 m_bg_widget = 0; 00944 m_widget_under_mouse = 0; 00945 m_tmp_con = 0; 00946 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::showEvent | ( | QShowEvent * | ) | [inline, virtual] |
This event handler can be reimplemented in a subclass to receive widget show events which are passed in the event parameter.
Non-spontaneous show events are sent to widgets immediately before they are shown. The spontaneous show events of windows are delivered afterwards.
Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible().
Reimplemented from QWidget.
Definition at line 169 of file connectionedit_p.h.
00170 { 00171 updateBackground(); 00172 }
| void qdesigner_internal::ConnectionEdit::aboutToAddConnection | ( | int | idx | ) | [signal] |
| void qdesigner_internal::ConnectionEdit::connectionAdded | ( | Connection * | con | ) | [signal] |
| void qdesigner_internal::ConnectionEdit::aboutToRemoveConnection | ( | Connection * | con | ) | [signal] |
| void qdesigner_internal::ConnectionEdit::connectionRemoved | ( | int | idx | ) | [signal] |
| void qdesigner_internal::ConnectionEdit::connectionSelected | ( | Connection * | con | ) | [signal] |
Referenced by setSelected().
| void qdesigner_internal::ConnectionEdit::widgetActivated | ( | QWidget * | wgt | ) | [signal] |
Referenced by mouseDoubleClickEvent(), and qdesigner_internal::SignalSlotEditor::SignalSlotEditor().
| void qdesigner_internal::ConnectionEdit::connectionChanged | ( | Connection * | con | ) | [signal] |
| void qdesigner_internal::ConnectionEdit::setBackground | ( | QWidget * | background | ) | [virtual, slot] |
Definition at line 948 of file connectionedit.cpp.
References background(), m_bg_widget, and updateBackground().
Referenced by qdesigner_internal::SignalSlotEditor::fromUi(), and qdesigner_internal::BuddyEditor::setBackground().
00949 { 00950 if (background == m_bg_widget) { 00951 // nothing to do 00952 return; 00953 } 00954 00955 m_bg_widget = background; 00956 updateBackground(); 00957 }
| void qdesigner_internal::ConnectionEdit::updateBackground | ( | ) | [virtual, slot] |
Definition at line 966 of file connectionedit.cpp.
References c, m_bg_widget, m_con_list, m_enable_update_background, QWidget::update(), and updateLines().
Referenced by enableUpdateBackground(), resizeEvent(), setBackground(), qdesigner_internal::BuddyEditor::updateBackground(), and widgetRemoved().
00967 { 00968 if (m_bg_widget == 0) 00969 return; 00970 00971 if (!m_enable_update_background) 00972 return; 00973 00974 foreach(Connection *c, m_con_list) 00975 c->updateVisibility(); 00976 00977 updateLines(); 00978 update(); 00979 }
| void qdesigner_internal::ConnectionEdit::widgetRemoved | ( | QWidget * | w | ) | [virtual, slot] |
Definition at line 1312 of file connectionedit.cpp.
References QMap< Key, T >::insert(), QMap< Key, T >::isEmpty(), QMap< Key, T >::keys(), m_con_list, m_undo_stack, QList< T >::prepend(), QUndoStack::push(), updateBackground(), w, and qdesigner_internal::Connection::widget().
Referenced by ConnectionEdit().
01313 { 01314 QList<QWidget*> child_list = qFindChildren<QWidget*>(widget); 01315 child_list.prepend(widget); 01316 01317 ConnectionSet remove_set; 01318 foreach (QWidget *w, child_list) { 01319 foreach (Connection *con, m_con_list) { 01320 if (con->widget(EndPoint::Source) == w || con->widget(EndPoint::Target) == w) 01321 remove_set.insert(con, con); 01322 } 01323 } 01324 01325 if (!remove_set.isEmpty()) 01326 m_undo_stack->push(new DeleteConnectionsCommand(this, remove_set.keys())); 01327 01328 updateBackground(); 01329 }
| void qdesigner_internal::ConnectionEdit::updateLines | ( | ) | [slot] |
Definition at line 1431 of file connectionedit.cpp.
References qdesigner_internal::Connection::checkWidgets(), and m_con_list.
Referenced by updateBackground().
01432 { 01433 foreach (Connection *con, m_con_list) 01434 con->checkWidgets(); 01435 }
| void qdesigner_internal::ConnectionEdit::enableUpdateBackground | ( | bool | enable | ) | [slot] |
Definition at line 959 of file connectionedit.cpp.
References m_enable_update_background, and updateBackground().
00960 { 00961 m_enable_update_background = enable; 00962 if (enable) 00963 updateBackground(); 00964 }
| void qdesigner_internal::ConnectionEdit::paintEvent | ( | QPaintEvent * | e | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive paint events which are passed in the event parameter.
A paint event is a request to repaint all or part of the widget. It can happen as a result of repaint() or update(), or because the widget was obscured and has now been uncovered, or for many other reasons.
Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QTableView do this, for example.
Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::united()). repaint() does not permit this optimization, so we suggest using update() whenever possible.
When the paint event occurs, the update region has normally been erased, so that you're painting on the widget's background.
The background can be set using setBackgroundRole() and setPalette().
From Qt 4.0, QWidget automatically double-buffers its painting, so there's no need to write double-buffering code in paintEvent() to avoid flicker.
Note: Under X11 it is possible to toggle the global double buffering by calling qt_x11_set_global_double_buffer(). Example usage:
...
extern void qt_x11_set_global_double_buffer(bool);
qt_x11_set_global_double_buffer(false);
...
Reimplemented from QWidget.
Definition at line 1045 of file connectionedit.cpp.
References QPalette::Base, BG_ALPHA, c, qdesigner_internal::Connection::endPointPos(), qdesigner_internal::fixRect(), QMap< Key, T >::insert(), QPointer< T >::isNull(), qdesigner_internal::Connection::isVisible(), m_active_color, m_bg_widget, m_con_list, m_inactive_color, m_tmp_con, m_widget_under_mouse, p, paintConnection(), qdesigner_internal::paintEndPoint(), paintLabel(), QWidget::palette(), QPaintEvent::region(), QMap< Key, T >::remove(), selected(), QPalette::Text, w, qdesigner_internal::Connection::widget(), and widgetRect().
01046 { 01047 QPainter p(this); 01048 p.setClipRegion(e->region()); 01049 01050 WidgetSet heavy_highlight_set, light_highlight_set; 01051 01052 foreach (Connection *con, m_con_list) { 01053 if (!con->isVisible()) 01054 continue; 01055 01056 paintConnection(&p, con, &heavy_highlight_set, &light_highlight_set); 01057 } 01058 01059 if (m_tmp_con != 0) 01060 paintConnection(&p, m_tmp_con, &heavy_highlight_set, &light_highlight_set); 01061 01062 if (!m_widget_under_mouse.isNull() && m_widget_under_mouse != m_bg_widget) 01063 heavy_highlight_set.insert(m_widget_under_mouse, m_widget_under_mouse); 01064 01065 QColor c = m_active_color; 01066 p.setPen(c); 01067 c.setAlpha(BG_ALPHA); 01068 p.setBrush(c); 01069 01070 foreach (QWidget *w, heavy_highlight_set) { 01071 p.drawRect(fixRect(widgetRect(w))); 01072 light_highlight_set.remove(w); 01073 } 01074 01075 c = m_inactive_color; 01076 p.setPen(c); 01077 c.setAlpha(BG_ALPHA); 01078 p.setBrush(c); 01079 01080 foreach (QWidget *w, light_highlight_set) 01081 p.drawRect(fixRect(widgetRect(w))); 01082 01083 p.setBrush(palette().color(QPalette::Base)); 01084 p.setPen(palette().color(QPalette::Text)); 01085 foreach (Connection *con, m_con_list) { 01086 if (!con->isVisible()) 01087 continue; 01088 01089 paintLabel(&p, EndPoint::Source, con); 01090 paintLabel(&p, EndPoint::Target, con); 01091 } 01092 01093 p.setPen(m_active_color); 01094 p.setBrush(m_active_color); 01095 01096 foreach (Connection *con, m_con_list) { 01097 if (!selected(con) || !con->isVisible()) 01098 continue; 01099 01100 paintEndPoint(&p, con->endPointPos(EndPoint::Source)); 01101 01102 if (con->widget(EndPoint::Target) != 0) 01103 paintEndPoint(&p, con->endPointPos(EndPoint::Target)); 01104 } 01105 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::mouseMoveEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget.
If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.
QMouseEvent::pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user's hand shakes. This is a feature of the underlying window system, not Qt.
Reimplemented from QWidget.
Definition at line 1222 of file connectionedit.cpp.
References QEvent::accept(), QMouseEvent::buttons(), Connecting, continueConnection(), continueDrag(), Qt::CrossCursor, Dragging, Editing, findObjectsUnderMouse(), QPointer< T >::isNull(), Qt::LeftButton, m_start_connection_on_drag, m_widget_under_mouse, QMouseEvent::pos(), QWidget::setCursor(), startConnection(), and state().
01223 { 01224 findObjectsUnderMouse(e->pos()); 01225 01226 switch (state()) { 01227 case Connecting: 01228 continueConnection(m_widget_under_mouse, e->pos()); 01229 break; 01230 case Editing: 01231 if ((e->buttons() & Qt::LeftButton) 01232 && m_start_connection_on_drag 01233 && !m_widget_under_mouse.isNull()) { 01234 m_start_connection_on_drag = false; 01235 startConnection(m_widget_under_mouse, e->pos()); 01236 setCursor(Qt::CrossCursor); 01237 } 01238 break; 01239 case Dragging: 01240 continueDrag(e->pos()); 01241 break; 01242 } 01243 01244 e->accept(); 01245 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::mousePressEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events for the widget.
If you create new widgets in the mousePressEvent() the mouseReleaseEvent() may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets' location and maybe more.
The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing.
Reimplemented from QWidget.
Definition at line 1117 of file connectionedit.cpp.
References abortConnection(), QEvent::accept(), QMouseEvent::button(), Connecting, connectionAt(), Dragging, Editing, QPointer< T >::isNull(), m_end_point_under_mouse, m_start_connection_on_drag, m_widget_under_mouse, QInputEvent::modifiers(), QMouseEvent::pos(), Qt::RightButton, selected(), selectNone(), setSelected(), Qt::ShiftModifier, startDrag(), and state().
01118 { 01119 e->accept(); 01120 01121 Connection *con_under_mouse = connectionAt(e->pos()); 01122 m_start_connection_on_drag = false; 01123 01124 switch (state()) { 01125 case Connecting: 01126 if (e->button() == Qt::RightButton) 01127 abortConnection(); 01128 break; 01129 case Dragging: 01130 break; 01131 case Editing: 01132 if (!m_end_point_under_mouse.isNull()) { 01133 if (!(e->modifiers() & Qt::ShiftModifier)) { 01134 startDrag(m_end_point_under_mouse, e->pos()); 01135 } 01136 } else if (con_under_mouse != 0) { 01137 if (!(e->modifiers() & Qt::ShiftModifier)) { 01138 selectNone(); 01139 setSelected(con_under_mouse, true); 01140 } else { 01141 setSelected(con_under_mouse, !selected(con_under_mouse)); 01142 } 01143 } else { 01144 if (!(e->modifiers() & Qt::ShiftModifier)) { 01145 selectNone(); 01146 if (!m_widget_under_mouse.isNull()) 01147 m_start_connection_on_drag = true; 01148 } 01149 } 01150 break; 01151 } 01152 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::mouseReleaseEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
This event handler, for event event, can be reimplemented in a subclass to receive mouse release events for the widget.
Reimplemented from QWidget.
Definition at line 1175 of file connectionedit.cpp.
References abortConnection(), QEvent::accept(), Connecting, Dragging, Editing, endConnection(), endDrag(), QPointer< T >::isNull(), m_widget_under_mouse, QMouseEvent::pos(), QWidget::setCursor(), and state().
01176 { 01177 e->accept(); 01178 01179 switch (state()) { 01180 case Connecting: 01181 if (m_widget_under_mouse.isNull()) 01182 abortConnection(); 01183 else 01184 endConnection(m_widget_under_mouse, e->pos()); 01185 setCursor(QCursor()); 01186 break; 01187 case Editing: 01188 break; 01189 case Dragging: 01190 endDrag(e->pos()); 01191 break; 01192 } 01193 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::keyPressEvent | ( | QKeyEvent * | e | ) | [protected, virtual] |
This event handler, for event event, can be reimplemented in a subclass to receive key press events for the widget.
A widget must call setFocusPolicy() to accept focus initially and have focus in order to receive a key press event.
If you reimplement this handler, it is very important that you ignore() the event if you do not understand it, so that the widget's parent can interpret it.
The default implementation closes popup widgets if the user presses Esc. Otherwise the event is ignored.
Reimplemented from QWidget.
Definition at line 1247 of file connectionedit.cpp.
References abortConnection(), QEvent::accept(), Connecting, deleteSelected(), Editing, QKeyEvent::key(), Qt::Key_Delete, Qt::Key_Escape, and state().
01248 { 01249 switch (e->key()) { 01250 case Qt::Key_Delete: 01251 if (state() == Editing) 01252 deleteSelected(); 01253 break; 01254 case Qt::Key_Escape: 01255 if (state() == Connecting) 01256 abortConnection(); 01257 break; 01258 } 01259 01260 e->accept(); 01261 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::mouseDoubleClickEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
This event handler, for event event, can be reimplemented in a subclass to receive mouse double click events for the widget.
The default implementation generates a normal mouse press event.
Note that the widgets gets a mousePressEvent() and a mouseReleaseEvent() before the mouseDoubleClickEvent().
Reimplemented from QWidget.
Definition at line 1154 of file connectionedit.cpp.
References abortConnection(), QEvent::accept(), Connecting, Dragging, Editing, emit, QPointer< T >::isNull(), QMap< Key, T >::keys(), m_sel_con_set, m_widget_under_mouse, modifyConnection(), QMap< Key, T >::size(), state(), and widgetActivated().
01155 { 01156 e->accept(); 01157 switch (state()) { 01158 case Connecting: 01159 abortConnection(); 01160 break; 01161 case Dragging: 01162 break; 01163 case Editing: 01164 if (!m_widget_under_mouse.isNull()) { 01165 emit widgetActivated(m_widget_under_mouse); 01166 } else if (m_sel_con_set.size() == 1) { 01167 Connection *con = m_sel_con_set.keys().first(); 01168 modifyConnection(con); 01169 } 01170 break; 01171 } 01172 01173 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::resizeEvent | ( | QResizeEvent * | e | ) | [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 1437 of file connectionedit.cpp.
References QWidget::resizeEvent(), and updateBackground().
01438 { 01439 updateBackground(); 01440 QWidget::resizeEvent(e); 01441 }
Here is the call graph for this function:

| Connection * qdesigner_internal::ConnectionEdit::createConnection | ( | QWidget * | source, | |
| QWidget * | target | |||
| ) | [protected, virtual] |
Definition at line 1306 of file connectionedit.cpp.
References Connection.
Referenced by endConnection().
01307 { 01308 Connection *con = new Connection(this, source, target); 01309 return con; 01310 }
| void qdesigner_internal::ConnectionEdit::modifyConnection | ( | Connection * | con | ) | [protected, virtual] |
| QWidget * qdesigner_internal::ConnectionEdit::widgetAt | ( | const QPoint & | pos | ) | const [protected, virtual] |
Definition at line 981 of file connectionedit.cpp.
References QWidget::childAt(), m_bg_widget, and QWidget::pos().
Referenced by findObjectsUnderMouse(), qdesigner_internal::SignalSlotEditor::widgetAt(), and qdesigner_internal::BuddyEditor::widgetAt().
00982 { 00983 if (m_bg_widget == 0) 00984 return 0; 00985 QWidget *widget = m_bg_widget->childAt(pos); 00986 if (widget == 0) 00987 widget = m_bg_widget; 00988 00989 return widget; 00990 }
Here is the call graph for this function:

Definition at line 993 of file connectionedit.cpp.
References QWidget::mapFromGlobal(), QRect::moveTopLeft(), QWidget::pos(), and w.
Referenced by adjustHotSopt(), findObjectsUnderMouse(), paintEvent(), qdesigner_internal::BuddyEditor::setBackground(), qdesigner_internal::SetEndPointCommand::SetEndPointCommand(), and qdesigner_internal::BuddyEditor::updateBackground().
00994 { 00995 if (w == 0) 00996 return QRect(); 00997 QRect r = w->geometry(); 00998 QPoint pos = w->mapToGlobal(QPoint(0, 0)); 00999 pos = mapFromGlobal(pos); 01000 r.moveTopLeft(pos); 01001 return r; 01002 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::addConnection | ( | Connection * | con | ) | [protected] |
Definition at line 1426 of file connectionedit.cpp.
References QList< T >::append(), and m_con_list.
Referenced by qdesigner_internal::SignalSlotEditor::fromUi(), and qdesigner_internal::BuddyEditor::setBackground().
01427 { 01428 m_con_list.append(con); 01429 }
Here is the call graph for this function:

| ConnectionEdit::State qdesigner_internal::ConnectionEdit::state | ( | ) | const [protected] |
Definition at line 1004 of file connectionedit.cpp.
References Connecting, Dragging, Editing, m_drag_end_point, and m_tmp_con.
Referenced by findObjectsUnderMouse(), keyPressEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and qdesigner_internal::BuddyEditor::widgetAt().
01005 { 01006 if (m_tmp_con != 0) 01007 return Connecting; 01008 if (!m_drag_end_point.isNull()) 01009 return Dragging; 01010 return Editing; 01011 }
| void qdesigner_internal::ConnectionEdit::endConnection | ( | QWidget * | target, | |
| const QPoint & | pos | |||
| ) | [protected, virtual] |
Definition at line 1271 of file connectionedit.cpp.
References AddConnectionCommand, createConnection(), qdesigner_internal::Connection::endPointPos(), findObjectsUnderMouse(), m_tmp_con, m_undo_stack, QWidget::mapFromGlobal(), QCursor::pos(), QWidget::pos(), QUndoStack::push(), QWidget::setEnabled(), qdesigner_internal::Connection::setEndPoint(), and qdesigner_internal::Connection::widget().
Referenced by mouseReleaseEvent().
01272 { 01273 Q_ASSERT(m_tmp_con != 0); 01274 01275 m_tmp_con->setEndPoint(EndPoint::Target, target, pos); 01276 01277 QWidget *source = m_tmp_con->widget(EndPoint::Source); 01278 Q_ASSERT(source != 0); 01279 Q_ASSERT(target != 0); 01280 setEnabled(false); 01281 Connection *new_con = createConnection(source, target); 01282 setEnabled(true); 01283 if (new_con != 0) { 01284 new_con->setEndPoint(EndPoint::Source, source, m_tmp_con->endPointPos(EndPoint::Source)); 01285 new_con->setEndPoint(EndPoint::Target, target, m_tmp_con->endPointPos(EndPoint::Target)); 01286 m_undo_stack->push(new AddConnectionCommand(this, new_con)); 01287 } 01288 01289 delete m_tmp_con; 01290 m_tmp_con = 0; 01291 01292 findObjectsUnderMouse(mapFromGlobal(QCursor::pos())); 01293 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::startConnection | ( | QWidget * | source, | |
| const QPoint & | pos | |||
| ) | [private] |
Definition at line 1263 of file connectionedit.cpp.
References Connection, m_tmp_con, QWidget::pos(), and qdesigner_internal::Connection::setEndPoint().
Referenced by mouseMoveEvent().
01264 { 01265 Q_ASSERT(m_tmp_con == 0); 01266 01267 m_tmp_con = new Connection(this); 01268 m_tmp_con->setEndPoint(EndPoint::Source, source, pos); 01269 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::continueConnection | ( | QWidget * | target, | |
| const QPoint & | pos | |||
| ) | [private] |
Definition at line 1295 of file connectionedit.cpp.
References m_tmp_con, QWidget::pos(), and qdesigner_internal::Connection::setEndPoint().
Referenced by mouseMoveEvent().
01296 { 01297 Q_ASSERT(m_tmp_con != 0); 01298 01299 m_tmp_con->setEndPoint(EndPoint::Target, target, pos); 01300 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::abortConnection | ( | ) | [private] |
Definition at line 1107 of file connectionedit.cpp.
References m_bg_widget, m_tmp_con, m_widget_under_mouse, QWidget::setCursor(), and qdesigner_internal::Connection::update().
Referenced by keyPressEvent(), mouseDoubleClickEvent(), mousePressEvent(), and mouseReleaseEvent().
01108 { 01109 m_tmp_con->update(); 01110 delete m_tmp_con; 01111 m_tmp_con = 0; 01112 setCursor(QCursor()); 01113 if (m_widget_under_mouse == m_bg_widget) 01114 m_widget_under_mouse = 0; 01115 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::findObjectsUnderMouse | ( | const QPoint & | pos | ) | [private] |
Definition at line 1196 of file connectionedit.cpp.
References Connecting, connectionAt(), endPointAt(), QPointer< T >::isNull(), m_bg_widget, m_end_point_under_mouse, m_widget_under_mouse, Qt::PointingHandCursor, QWidget::pos(), QWidget::setCursor(), state(), QWidget::update(), w, widgetAt(), and widgetRect().
Referenced by endConnection(), qdesigner_internal::BuddyEditor::endConnection(), and mouseMoveEvent().
01197 { 01198 Connection *con_under_mouse = connectionAt(pos); 01199 QWidget *w = con_under_mouse != 0 ? 0 : widgetAt(pos); 01200 01201 if (state() != Connecting && w == m_bg_widget) 01202 w = 0; 01203 01204 if (w != m_widget_under_mouse) { 01205 if (!m_widget_under_mouse.isNull()) 01206 update(widgetRect(m_widget_under_mouse)); 01207 m_widget_under_mouse = w; 01208 if (!m_widget_under_mouse.isNull()) 01209 update(widgetRect(m_widget_under_mouse)); 01210 } 01211 01212 EndPoint hs = endPointAt(pos); 01213 if (hs != m_end_point_under_mouse) { 01214 if (m_end_point_under_mouse.isNull()) 01215 setCursor(Qt::PointingHandCursor); 01216 else 01217 setCursor(QCursor()); 01218 m_end_point_under_mouse = hs; 01219 } 01220 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::startDrag | ( | const EndPoint & | end_point, | |
| const QPoint & | pos | |||
| ) | [private] |
Definition at line 1384 of file connectionedit.cpp.
References adjustHotSopt(), m_drag_end_point, m_old_source_pos, m_old_target_pos, and QWidget::pos().
Referenced by mousePressEvent().
01385 { 01386 Q_ASSERT(m_drag_end_point.isNull()); 01387 m_drag_end_point = end_point; 01388 m_old_source_pos = m_drag_end_point.con->endPointPos(EndPoint::Source); 01389 m_old_target_pos = m_drag_end_point.con->endPointPos(EndPoint::Target); 01390 adjustHotSopt(m_drag_end_point, pos); 01391 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::continueDrag | ( | const QPoint & | pos | ) | [private] |
Definition at line 1393 of file connectionedit.cpp.
References adjustHotSopt(), m_drag_end_point, and QWidget::pos().
Referenced by mouseMoveEvent().
01394 { 01395 Q_ASSERT(!m_drag_end_point.isNull()); 01396 adjustHotSopt(m_drag_end_point, pos); 01397 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::endDrag | ( | const QPoint & | pos | ) | [private] |
Definition at line 1399 of file connectionedit.cpp.
References adjustHotSopt(), qdesigner_internal::Connection::endPointPos(), m_drag_end_point, m_old_source_pos, m_old_target_pos, m_undo_stack, QWidget::pos(), and QUndoStack::push().
Referenced by mouseReleaseEvent().
01400 { 01401 Q_ASSERT(!m_drag_end_point.isNull()); 01402 adjustHotSopt(m_drag_end_point, pos); 01403 01404 Connection *con = m_drag_end_point.con; 01405 QPoint new_source_pos = con->endPointPos(EndPoint::Source); 01406 QPoint new_target_pos = con->endPointPos(EndPoint::Target); 01407 m_undo_stack->push(new AdjustConnectionCommand(this, con, m_old_source_pos, m_old_target_pos, 01408 new_source_pos, new_target_pos)); 01409 01410 m_drag_end_point = EndPoint(); 01411 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::adjustHotSopt | ( | const EndPoint & | end_point, | |
| const QPoint & | pos | |||
| ) | [private] |
Definition at line 1413 of file connectionedit.cpp.
References qdesigner_internal::pointInsideRect(), QWidget::pos(), w, and widgetRect().
Referenced by continueDrag(), endDrag(), and startDrag().
01414 { 01415 QWidget *w = end_point.con->widget(end_point.type); 01416 end_point.con->setEndPoint(end_point.type, w, pointInsideRect(widgetRect(w), pos)); 01417 }
Here is the call graph for this function:

| Connection * qdesigner_internal::ConnectionEdit::connectionAt | ( | const QPoint & | pos | ) | const [private] |
Definition at line 1359 of file connectionedit.cpp.
References qdesigner_internal::Connection::contains(), m_con_list, and QWidget::pos().
Referenced by findObjectsUnderMouse(), and mousePressEvent().
01360 { 01361 foreach (Connection *con, m_con_list) { 01362 if (con->contains(pos)) 01363 return con; 01364 } 01365 return 0; 01366 }
Here is the call graph for this function:

| CETypes::EndPoint qdesigner_internal::ConnectionEdit::endPointAt | ( | const QPoint & | pos | ) | const [private] |
Definition at line 1368 of file connectionedit.cpp.
References QRect::contains(), qdesigner_internal::Connection::endPointRect(), m_con_list, QWidget::pos(), and selected().
Referenced by findObjectsUnderMouse().
01369 { 01370 foreach (Connection *con, m_con_list) { 01371 if (!selected(con)) 01372 continue; 01373 QRect sr = con->endPointRect(EndPoint::Source); 01374 QRect tr = con->endPointRect(EndPoint::Target); 01375 01376 if (sr.contains(pos)) 01377 return EndPoint(con, EndPoint::Source); 01378 if (tr.contains(pos)) 01379 return EndPoint(con, EndPoint::Target); 01380 } 01381 return EndPoint(); 01382 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::paintConnection | ( | QPainter * | p, | |
| Connection * | con, | |||
| WidgetSet * | heavy_highlight_set, | |||
| WidgetSet * | light_highlight_set | |||
| ) | const [private] |
Definition at line 1026 of file connectionedit.cpp.
References m_active_color, m_bg_widget, m_inactive_color, m_tmp_con, p, qdesigner_internal::Connection::paint(), selected(), set(), and qdesigner_internal::Connection::widget().
Referenced by paintEvent().
01029 { 01030 QWidget *source = con->widget(EndPoint::Source); 01031 QWidget *target = con->widget(EndPoint::Target); 01032 01033 bool heavy = selected(con) || con == m_tmp_con; 01034 WidgetSet *set = heavy ? heavy_highlight_set : light_highlight_set; 01035 p->setPen(heavy ? m_active_color : m_inactive_color); 01036 con->paint(p); 01037 01038 if (source != 0) 01039 set->insert(source, source); 01040 01041 if (target != 0 && target != m_bg_widget) 01042 set->insert(target, target); 01043 }
Here is the call graph for this function:

| void qdesigner_internal::ConnectionEdit::paintLabel | ( | QPainter * | p, | |
| EndPoint::Type | type, | |||
| Connection * | con | |||
| ) | [private] |
Definition at line 1013 of file connectionedit.cpp.
References qdesigner_internal::fixRect(), QString::isEmpty(), qdesigner_internal::Connection::label(), qdesigner_internal::Connection::labelPixmap(), qdesigner_internal::Connection::labelRect(), m_active_color, m_inactive_color, m_tmp_con, Qt::NoBrush, p, selected(), and QRect::topLeft().
Referenced by paintEvent().
01014 { 01015 if (con->label(type).isEmpty()) 01016 return; 01017 01018 bool heavy = selected(con) || con == m_tmp_con; 01019 p->setPen(heavy ? m_active_color : m_inactive_color); 01020 p->setBrush(Qt::NoBrush); 01021 QRect r = con->labelRect(type); 01022 p->drawPixmap(r.topLeft(), con->labelPixmap(type)); 01023 p->drawRect(fixRect(r)); 01024 }
Here is the call graph for this function:

friend class Connection [friend] |
Definition at line 245 of file connectionedit_p.h.
Referenced by createConnection(), qdesigner_internal::BuddyEditor::createConnection(), qdesigner_internal::BuddyEditor::setBackground(), startConnection(), and qdesigner_internal::BuddyEditor::updateBackground().
friend class BuddyEditor [friend] |
Definition at line 246 of file connectionedit_p.h.
friend class AddConnectionCommand [friend] |
Definition at line 247 of file connectionedit_p.h.
Referenced by qdesigner_internal::SignalSlotEditor::addEmptyConnection(), and endConnection().
friend class DeleteConnectionsCommand [friend] |
friend class SetEndPointCommand [friend] |
Definition at line 211 of file connectionedit_p.h.
Referenced by abortConnection(), clear(), ConnectionEdit(), findObjectsUnderMouse(), paintConnection(), paintEvent(), setBackground(), setSource(), setTarget(), updateBackground(), and widgetAt().
Definition at line 212 of file connectionedit_p.h.
Referenced by ConnectionEdit(), deleteSelected(), endConnection(), endDrag(), setSource(), setTarget(), and widgetRemoved().
Definition at line 213 of file connectionedit_p.h.
Referenced by ConnectionEdit(), enableUpdateBackground(), and updateBackground().
Definition at line 215 of file connectionedit_p.h.
Referenced by abortConnection(), clear(), ConnectionEdit(), continueConnection(), endConnection(), qdesigner_internal::BuddyEditor::endConnection(), paintConnection(), paintEvent(), paintLabel(), startConnection(), and state().
Definition at line 216 of file connectionedit_p.h.
Referenced by addConnection(), clear(), connectionAt(), qdesigner_internal::BuddyEditor::deleteSelected(), qdesigner_internal::BuddyEditor::endConnection(), endPointAt(), paintEvent(), qdesigner_internal::AddConnectionCommand::redo(), qdesigner_internal::DeleteConnectionsCommand::redo(), qdesigner_internal::DeleteConnectionsCommand::undo(), qdesigner_internal::AddConnectionCommand::undo(), qdesigner_internal::BuddyEditor::updateBackground(), updateBackground(), updateLines(), widgetRemoved(), and qdesigner_internal::BuddyEditor::widgetRemoved().
Definition at line 217 of file connectionedit_p.h.
Referenced by ConnectionEdit(), mouseMoveEvent(), and mousePressEvent().
EndPoint qdesigner_internal::ConnectionEdit::m_end_point_under_mouse [private] |
Definition at line 223 of file connectionedit_p.h.
Referenced by findObjectsUnderMouse(), and mousePressEvent().
Definition at line 224 of file connectionedit_p.h.
Referenced by abortConnection(), clear(), ConnectionEdit(), findObjectsUnderMouse(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and paintEvent().
EndPoint qdesigner_internal::ConnectionEdit::m_drag_end_point [private] |
Definition at line 226 of file connectionedit_p.h.
Referenced by continueDrag(), endDrag(), startDrag(), and state().
Definition at line 235 of file connectionedit_p.h.
Referenced by clear(), deleteSelected(), qdesigner_internal::BuddyEditor::deleteSelected(), mouseDoubleClickEvent(), selected(), selectNone(), and setSelected().
Definition at line 242 of file connectionedit_p.h.
Referenced by ConnectionEdit(), paintConnection(), paintEvent(), and paintLabel().
Definition at line 242 of file connectionedit_p.h.
Referenced by ConnectionEdit(), paintConnection(), paintEvent(), and paintLabel().
1.5.1