24 #if defined (HAVE_CONFIG_H) 28 #include <QApplication> 31 #include <QHBoxLayout> 44 QStyle *st = style ();
45 m_icon_size = 0.75*st->pixelMetric (QStyle::PM_SmallIconSize);
51 (QIcon (
":/actions/icons/widget-undock.png"),
"",
this);
59 (QIcon (
":/actions/icons/widget-close.png"),
"",
this);
66 QString css_button = QString (
"QToolButton {background: transparent; border: 0px;}");
70 QHBoxLayout *h_layout =
new QHBoxLayout ();
71 h_layout->addStretch (100);
74 h_layout->setSpacing (0);
75 h_layout->setContentsMargins (5,2,2,2);
81 connect (
p, SIGNAL (copyClipboard_signal ()),
83 connect (
p, SIGNAL (pasteClipboard_signal ()),
85 connect (
p, SIGNAL (selectAll_signal ()),
88 connect (
p, SIGNAL (undo_signal ()),
this, SLOT (
do_undo ()));
96 =
static_cast<QHBoxLayout *
> (titleBarWidget ()->layout ());
97 QLabel *label =
new QLabel (title, titleBarWidget ());
98 label->setStyleSheet (
"background: transparent;");
99 h_layout->insertWidget (0,label);
100 setWindowTitle (title);
111 connect (
this, SIGNAL (visibilityChanged (
bool)),
114 connect (
p, SIGNAL (settings_changed (
const QSettings*)),
122 setFeatures (QDockWidget::DockWidgetMovable);
134 installEventFilter (
this);
136 setFocusPolicy (Qt::StrongFocus);
143 connect (
this, SIGNAL (visibilityChanged (
bool)),
157 settings->setValue (
"DockWidgets/" + objectName () +
"_dock_area",
159 settings->setValue (
"DockWidgets/" + objectName (), saveGeometry ());
163 setTitleBarWidget (0);
164 setParent (0, Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
165 Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
167 setParent (0, Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
168 Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
170 #if defined (Q_OS_UNIX) 172 tr (
"Use <Alt> + <Left Mouse Button> for moving the window"));
180 setGeometry (settings->value (
"DockWidgets/" + objectName ()
181 +
"_floating_geometry",
182 QRect (50,100,480,480)).toRect ());
199 settings->setValue (
"DockWidgets/" + objectName () +
"_floating_geometry",
205 settings->setValue (
"MainWindow/windowState",
m_parent->saveState ());
209 m_parent->addDockWidget (Qt::TopDockWidgetArea,
this);
211 m_parent->restoreState (settings->value (
"MainWindow/windowState").toByteArray ());
214 QApplication::setActiveWindow (
this);
221 m_dock_action->setIcon (QIcon (
":/actions/icons/widget-undock" 241 QDockWidget::closeEvent (
e);
248 QWidget *
w = QApplication::focusWidget ();
249 if (
w &&
w->focusProxy ())
w =
w->focusProxy ();
257 = settings->value (
"DockWidgets/widget_title_custom_style",
false).toBool ();
260 = settings->value (
"DockWidgets/widget_title_3d",50).toInt ();
262 QColor default_var = QColor (0,0,0);
263 m_fg_color = settings->value (
"DockWidgets/title_fg_color",
264 default_var).value<QColor> ();
265 default_var = QColor (0,0,0);
267 default_var).value<QColor> ();
269 default_var = QColor (255,255,255);
270 m_bg_color = settings->value (
"DockWidgets/title_bg_color",
271 default_var).value<QColor> ();
272 default_var = QColor (192,192,192);
274 default_var).value<QColor> ();
281 bcol = QWidget::palette ().color (
m_title_widget->backgroundRole());
286 bcol.getRgb (&r, &g, &
b);
292 bcola.getRgb (&r, &g, &
b);
324 QString
name = objectName ();
330 settings->beginGroup (
"DockWidgets");
333 settings->setValue (
name+
"_floating_geometry", geometry ());
335 settings->setValue (
name, saveGeometry ());
337 settings->setValue (
name+
"Visible", isVisible ());
339 settings->setValue (
name+
"_minimized", isMinimized ());
341 settings->endGroup ();
347 if (
e->type () == QEvent::NonClientAreaMouseButtonDblClick)
353 return QDockWidget::eventFilter (obj,
e);
387 dock_icon =
"widget-dock";
389 dock_icon =
"widget-undock";
391 #if defined (Q_OS_MAC) 392 QString alignment =
"center";
394 QString alignment =
"center left";
399 QColor bg_col, fg_col;
414 QColor bg_col_top, bg_col_bottom;
417 bg_col_top = bg_col.lighter (100 +
m_title_3d);
418 bg_col_bottom = bg_col.darker (100 +
m_title_3d);
422 bg_col_top = bg_col.darker (100 -
m_title_3d);
423 bg_col_bottom = bg_col.lighter (100 -
m_title_3d);
427 QString (
"background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," 428 " stop: 0 %1, stop: 0.60 %2, stop: 0.95 %2 stop: 1.0 %3);").
429 arg (bg_col_top.name ()).
430 arg (bg_col.name ()).
431 arg (bg_col_bottom.name ());
433 css = background + QString (
" color: %1 ;").
arg (fg_col.name ());
441 css_button = QString (
"QToolButton {background: transparent; border: 0px;}");
444 m_dock_action->setIcon (QIcon (
":/actions/icons/" + dock_icon + icon_col +
446 m_close_action->setIcon (QIcon (
":/actions/icons/widget-close" + icon_col +
465 "DockWidgets/title_bg_color");
467 "DockWidgets/title_bg_color_active");
469 "DockWidgets/title_fg_color");
471 "DockWidgets/title_fg_color_active");
nd deftypefn *std::string name
std::complex< double > w(std::complex< double > z, double relerr=0)
octave_value arg(void) const
static QSettings * get_settings(void)
static bool update_settings_key(const QString &new_key, const QString &old_key)