Merge branch 'qt6'

This commit is contained in:
Matthias Koefferlein
2022-01-06 21:48:02 +01:00
2334 changed files with 759796 additions and 59323 deletions
@@ -92,29 +92,6 @@ public:
gsi::Callback get_cb;
};
}
namespace tl
{
// type traits for BrowserDialog_Stub
template <>
struct type_traits<gsi::BrowserDialog_Stub> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
// type traits for BrowserPanel
template <>
struct type_traits<lay::BrowserPanel> : public type_traits<void> {
typedef tl::false_tag has_default_constructor;
typedef tl::false_tag has_copy_constructor;
};
}
namespace gsi
{
// ---------------------------------------------------------------------------------
// Value classes with "not set" capabilities
-12
View File
@@ -24,18 +24,6 @@
#include "gsiDecl.h"
#include "layLayoutView.h"
namespace tl
{
// NOTE: we don't want references to be passed around and be default-constructed.
// References are only meant as return values for the layer properties iterator and
// be short-living. Hence we disable copying (which will also disable the default
// "assign" implementation) and default construction.
template <> struct type_traits<lay::LayerPropertiesNodeRef> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
namespace gsi
{
-7
View File
@@ -46,13 +46,6 @@ public:
}
namespace tl
{
template <> struct type_traits<ActionStub> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
namespace gsi
{
@@ -27,18 +27,6 @@
#include "layNetlistBrowserDialog.h"
#include "layLayoutView.h"
namespace tl
{
// disable copy and default constructor for NetlistBrowserDialog
template <> struct type_traits<lay::NetlistBrowserDialog> : public type_traits<void>
{
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
namespace gsi
{
-15
View File
@@ -32,21 +32,6 @@ namespace gsi
{
class PluginFactoryBase;
class PluginBase;
}
namespace tl
{
template <> struct type_traits<gsi::PluginFactoryBase> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
template <> struct type_traits<gsi::PluginBase> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
namespace gsi
{
// TODO: these static variables are a bad hack!
// However it's not easy to pass parameters to a C++ classes constructor in Ruby without
+44 -47
View File
@@ -58,19 +58,11 @@
#include <fstream>
#include <sstream>
#include <map>
#include <memory>
// --------------------------------------------------------------
// A helper class that allows putting a QImage into a tl::Variant
namespace tl
{
template <>
struct type_traits <QImage> : public type_traits<void>
{
typedef true_tag has_equal_operator;
};
}
namespace gtf
{
@@ -376,14 +368,14 @@ MouseTrackerWidget::set (const QMouseEvent &me)
if (me.button () == Qt::RightButton) {
mp_current_pixmap = &m_rb_pm;
} else if (me.button () == Qt::MidButton) {
} else if (me.button () == Qt::MiddleButton) {
mp_current_pixmap = &m_mb_pm;
} else if (me.button () == Qt::LeftButton) {
mp_current_pixmap = &m_lb_pm;
} else if (me.type () == QEvent::MouseMove) {
if (me.buttons () & Qt::RightButton) {
mp_current_pixmap = &m_rb_pm;
} else if (me.buttons () & Qt::MidButton) {
} else if (me.buttons () & Qt::MiddleButton) {
mp_current_pixmap = &m_mb_pm;
} else if (me.buttons () & Qt::LeftButton) {
mp_current_pixmap = &m_lb_pm;
@@ -578,7 +570,12 @@ class LogMouseEvent
{
public:
LogMouseEvent (const std::string &target, const QMouseEvent &me, int xml_line = 0)
: LogTargetedEvent (target, xml_line), m_mouse_event (me)
: LogTargetedEvent (target, xml_line),
#if QT_VERSION >= 0x60000
m_mouse_event (new QMouseEvent (me.type (), me.position (), me.globalPosition (), me.button (), me.buttons (), me.modifiers ()))
#else
m_mouse_event (new QMouseEvent (me.type (), me.pos (), me.button (), me.buttons (), me.modifiers ()))
#endif
{
// .. nothing yet ..
}
@@ -587,11 +584,11 @@ public:
{
QWidget *target = target_widget ();
if (m_mouse_event.type () == QEvent::MouseButtonPress) {
if (m_mouse_event->type () == QEvent::MouseButtonPress) {
target->setFocus ();
}
QMouseEvent me (m_mouse_event.type (), m_mouse_event.pos (), target->mapToGlobal (m_mouse_event.pos ()), m_mouse_event.button (), m_mouse_event.buttons (), m_mouse_event.modifiers ());
QMouseEvent me (m_mouse_event->type (), m_mouse_event->pos (), m_mouse_event->globalPos (), m_mouse_event->button (), m_mouse_event->buttons (), m_mouse_event->modifiers ());
MouseTrackerWidget::instance ()->set (me);
Player::instance ()->issue_event (target, &me);
}
@@ -599,13 +596,13 @@ public:
virtual const char *name () const
{
const char *event_name = "";
if (m_mouse_event.type () == QEvent::MouseMove) {
if (m_mouse_event->type () == QEvent::MouseMove) {
event_name = "mouse_move";
} else if (m_mouse_event.type() == QEvent::MouseButtonDblClick) {
} else if (m_mouse_event->type() == QEvent::MouseButtonDblClick) {
event_name = "mouse_button_dbl_click";
} else if (m_mouse_event.type() == QEvent::MouseButtonPress) {
} else if (m_mouse_event->type() == QEvent::MouseButtonPress) {
event_name = "mouse_button_press";
} else if (m_mouse_event.type() == QEvent::MouseButtonRelease) {
} else if (m_mouse_event->type() == QEvent::MouseButtonRelease) {
event_name = "mouse_button_release";
}
return event_name;
@@ -615,29 +612,29 @@ public:
{
LogTargetedEvent::attributes (attr);
attr.push_back (std::make_pair (std::string ("xpos"), tl::to_string (m_mouse_event.x ())));
attr.push_back (std::make_pair (std::string ("ypos"), tl::to_string (m_mouse_event.y ())));
if (m_mouse_event.type () == QEvent::MouseMove) {
attr.push_back (std::make_pair (std::string ("buttons"), tl::sprintf ("%x", int (m_mouse_event.buttons ()))));
attr.push_back (std::make_pair (std::string ("xpos"), tl::to_string (m_mouse_event->x ())));
attr.push_back (std::make_pair (std::string ("ypos"), tl::to_string (m_mouse_event->y ())));
if (m_mouse_event->type () == QEvent::MouseMove) {
attr.push_back (std::make_pair (std::string ("buttons"), tl::sprintf ("%x", int (m_mouse_event->buttons ()))));
} else {
attr.push_back (std::make_pair (std::string ("button"), tl::sprintf ("%x", int (m_mouse_event.button ()))));
attr.push_back (std::make_pair (std::string ("button"), tl::sprintf ("%x", int (m_mouse_event->button ()))));
}
attr.push_back (std::make_pair (std::string ("modifiers"), tl::sprintf ("%x", int (m_mouse_event.modifiers ()))));
attr.push_back (std::make_pair (std::string ("modifiers"), tl::sprintf ("%x", int (m_mouse_event->modifiers ()))));
}
const QMouseEvent &event () const
{
return m_mouse_event;
return *m_mouse_event;
}
void move (const QPoint &p)
{
m_mouse_event = QMouseEvent (m_mouse_event.type (),
m_mouse_event.pos () + p,
m_mouse_event.globalPos () + p,
m_mouse_event.button (),
m_mouse_event.buttons (),
m_mouse_event.modifiers ());
m_mouse_event.reset (new QMouseEvent (m_mouse_event->type (),
m_mouse_event->pos () + p,
m_mouse_event->globalPos () + p,
m_mouse_event->button (),
m_mouse_event->buttons (),
m_mouse_event->modifiers ()));
}
bool equals (const LogEventBase &b) const
@@ -648,14 +645,14 @@ public:
}
return LogTargetedEvent::equals (b) &&
m_mouse_event.type () == be->m_mouse_event.type () &&
m_mouse_event.pos () == be->m_mouse_event.pos () &&
m_mouse_event.modifiers () == be->m_mouse_event.modifiers () &&
m_mouse_event.buttons () == be->m_mouse_event.buttons ();
m_mouse_event->type () == be->m_mouse_event->type () &&
m_mouse_event->pos () == be->m_mouse_event->pos () &&
m_mouse_event->modifiers () == be->m_mouse_event->modifiers () &&
m_mouse_event->buttons () == be->m_mouse_event->buttons ();
}
private:
QMouseEvent m_mouse_event;
std::unique_ptr<QMouseEvent> m_mouse_event;
};
class LogKeyEvent
@@ -663,20 +660,20 @@ class LogKeyEvent
{
public:
LogKeyEvent (const std::string &target, const QKeyEvent &ke, int xml_line = 0)
: LogTargetedEvent (target, xml_line), m_key_event (ke)
: LogTargetedEvent (target, xml_line), m_key_event (new QKeyEvent (ke.type (), ke.key (), ke.modifiers ()))
{
// .. nothing yet ..
}
virtual void issue_event ()
{
QKeyEvent ke (m_key_event);
Player::instance ()->issue_event (target_widget (), &ke);
std::unique_ptr<QKeyEvent> ke (new QKeyEvent (m_key_event->type (), m_key_event->key (), m_key_event->modifiers ()));
Player::instance ()->issue_event (target_widget (), ke.get ());
}
virtual const char *name () const
{
if (m_key_event.type() == QEvent::KeyPress) {
if (m_key_event->type() == QEvent::KeyPress) {
return "key_press";
} else {
return "key_release";
@@ -688,13 +685,13 @@ public:
LogTargetedEvent::attributes (attr);
QChar ch;
if (! m_key_event.text ().isEmpty ()) {
ch = m_key_event.text ().at (0);
if (! m_key_event->text ().isEmpty ()) {
ch = m_key_event->text ().at (0);
}
attr.push_back (std::make_pair (std::string ("key"), tl::sprintf ("%x", int (m_key_event.key ()))));
attr.push_back (std::make_pair (std::string ("key"), tl::sprintf ("%x", int (m_key_event->key ()))));
attr.push_back (std::make_pair (std::string ("code"), tl::sprintf ("%x", int (ch.unicode ()))));
attr.push_back (std::make_pair (std::string ("modifiers"), tl::sprintf ("%x", int (m_key_event.modifiers ()))));
attr.push_back (std::make_pair (std::string ("modifiers"), tl::sprintf ("%x", int (m_key_event->modifiers ()))));
}
bool equals (const LogEventBase &b) const
@@ -705,12 +702,12 @@ public:
}
return LogTargetedEvent::equals (b) &&
m_key_event.modifiers () == be->m_key_event.modifiers () &&
m_key_event.key () == be->m_key_event.key ();
m_key_event->modifiers () == be->m_key_event->modifiers () &&
m_key_event->key () == be->m_key_event->key ();
}
private:
QKeyEvent m_key_event;
std::unique_ptr<QKeyEvent> m_key_event;
};
class LogActionEvent
+2 -1
View File
@@ -30,6 +30,7 @@
#include "gsi.h"
#include <QAction>
#include <QActionGroup>
#include <QMenu>
#include <QMenuBar>
#include <QShortcutEvent>
@@ -921,7 +922,7 @@ AbstractMenu::build_detached (const std::string &name, QFrame *mbar)
}
QHBoxLayout *menu_layout = new QHBoxLayout (mbar);
menu_layout->setMargin (0);
menu_layout->setContentsMargins (0, 0, 0, 0);
mbar->setLayout (menu_layout);
AbstractMenuItem *item = find_item_exact ("@@" + name);
-17
View File
@@ -822,23 +822,6 @@ private:
}
namespace tl
{
template <> struct type_traits<lay::AbstractMenu> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template <> struct type_traits<lay::AbstractMenuItem> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template <> struct type_traits<lay::Action> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
#endif
+1 -1
View File
@@ -96,7 +96,7 @@ BookmarksView::BookmarksView (LayoutView *view, QWidget *parent, const char *nam
mp_view = view;
QVBoxLayout *layout = new QVBoxLayout ();
layout->setMargin (0);
layout->setContentsMargins (0, 0, 0, 0);
setLayout (layout);
mp_bookmarks = new QListView (this);
@@ -479,7 +479,7 @@ BrowseInstancesForm::cell_changed (QTreeWidgetItem *item, QTreeWidgetItem *)
if (lv_cell_instance->topLevelItemCount () > 0) {
QTreeWidgetItem *item = lv_cell_instance->topLevelItem (0);
lv_cell_instance->setItemSelected (item, true);
item->setSelected (true);
lv_cell_instance->setCurrentItem (item);
lv_cell_instance->scrollToItem (item);
}
@@ -612,7 +612,11 @@ BrowseInstancesForm::change_cell (db::cell_index_type cell_index, int cv_index)
for (int col = 0; col < 3; ++col) {
all->setFont (col, f);
#if QT_VERSION >= 0x60000
all->setForeground (col, tc);
#else
all->setTextColor (col, tc);
#endif
}
// create the entries.
@@ -636,7 +640,7 @@ BrowseInstancesForm::change_cell (db::cell_index_type cell_index, int cv_index)
// make the first the current one
if (sel_item) {
lv_cell->setCurrentItem (sel_item);
lv_cell->setItemSelected (sel_item, true);
sel_item->setSelected (true);
lv_cell->scrollToItem (sel_item);
}
@@ -877,7 +881,7 @@ BrowseInstancesForm::adv_cell_inst (bool up)
}
if (ni) {
lv_cell_instance->setCurrentItem (ni);
lv_cell_instance->setItemSelected (ni, true);
ni->setSelected (true);
lv_cell_instance->scrollToItem (ni);
}
+11 -7
View File
@@ -297,7 +297,11 @@ public:
for (int col = 0; col < 3; ++col) {
setFont (col, f);
#if QT_VERSION >= 0x60000
setForeground (col, tc);
#else
setTextColor (col, tc);
#endif
}
}
};
@@ -627,7 +631,7 @@ BrowseShapesForm::cell_changed (QTreeWidgetItem *item, QTreeWidgetItem *)
lv_shape_instance->addTopLevelItems (items);
if (lv_shape_instance->topLevelItemCount () > 0) {
lv_shape_instance->setItemSelected (lv_shape_instance->topLevelItem (0), true);
lv_shape_instance->topLevelItem (0)->setSelected (true);
lv_shape_instance->setCurrentItem (lv_shape_instance->topLevelItem (0));
}
@@ -814,7 +818,7 @@ BrowseShapesForm::update_cell_list ()
if (sel_item) {
lv_cell->setCurrentItem (sel_item);
lv_cell->setItemSelected (sel_item, true);
sel_item->setSelected (true);
lv_cell->scrollToItem (sel_item);
}
}
@@ -992,7 +996,7 @@ BrowseShapesForm::adv_cell (bool up)
if (litem) {
QTreeWidgetItem *ni = litem->child (0);
lv_cell->setCurrentItem (ni);
lv_cell->setItemSelected (ni, true);
ni->setSelected (true);
lv_cell->scrollToItem (ni);
}
} else if (current->parent () == litem) {
@@ -1008,12 +1012,12 @@ BrowseShapesForm::adv_cell (bool up)
if (litem) {
QTreeWidgetItem *ni = litem->child (litem->childCount () - 1);
lv_cell->setCurrentItem (ni);
lv_cell->setItemSelected (ni, true);
ni->setSelected (true);
lv_cell->scrollToItem (ni);
} else {
// revert to the original
lv_cell->setCurrentItem (current);
lv_cell->setItemSelected (current, true);
current->setSelected (true);
lv_cell->scrollToItem (current);
}
}
@@ -1047,7 +1051,7 @@ BrowseShapesForm::adv_shape (bool up)
QTreeWidgetItem *ni = lv_shape_instance->topLevelItem (lv_shape_instance->topLevelItemCount () - 1);
if (ni) {
lv_shape_instance->setCurrentItem (ni);
lv_shape_instance->setItemSelected (ni, true);
ni->setSelected (true);
lv_shape_instance->scrollToItem (ni);
}
}
@@ -1089,7 +1093,7 @@ BrowseShapesForm::adv_cell_inst (bool up)
}
if (ni) {
lv_cell_instance->setCurrentItem (ni);
lv_cell_instance->setItemSelected (ni, true);
ni->setSelected (true);
lv_cell_instance->scrollToItem (ni);
}
-11
View File
@@ -130,16 +130,5 @@ private:
}
namespace tl
{
template <> struct type_traits<lay::BrowserDialog> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
template <> struct type_traits<lay::BrowserSource> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
#endif
+1 -1
View File
@@ -823,7 +823,7 @@ CellTreeModel::data (const QModelIndex &index, int role) const
return QVariant ();
}
} else if (role == Qt::TextColorRole) {
} else if (role == Qt::ForegroundRole) {
#if 0 // do strikeout rather than making the color darker
if (! mp_view) {
@@ -110,7 +110,7 @@ ConfigurationDialog::init (const lay::PluginDeclaration *decl)
for (std::vector <lay::ConfigPage *>::iterator p = m_config_pages.begin (); p != m_config_pages.end (); ++p) {
if ((*p)->layout ()) {
(*p)->layout ()->setMargin (0);
(*p)->layout ()->setContentsMargins (0, 0, 0, 0);
}
(*p)->setup (mp_root);
}
@@ -43,7 +43,11 @@ D25TechnologyComponentEditor::D25TechnologyComponentEditor (QWidget *parent)
QResource res (tl::to_qstring (":/syntax/d25_text.xml"));
QByteArray data ((const char *) res.data (), int (res.size ()));
#if QT_VERSION >= 0x60000
if (res.compressionAlgorithm () == QResource::ZlibCompression) {
#else
if (res.isCompressed ()) {
#endif
data = qUncompress (data);
}
+4
View File
@@ -1075,7 +1075,11 @@ UserPropertiesForm::UserPropertiesForm (QWidget *parent)
QResource res (tl::to_qstring (":/syntax/ur_text.xml"));
QByteArray data ((const char *) res.data (), int (res.size ()));
#if QT_VERSION >= 0x60000
if (res.compressionAlgorithm () == QResource::ZlibCompression) {
#else
if (res.isCompressed ()) {
#endif
data = qUncompress (data);
}
+32 -6
View File
@@ -36,7 +36,6 @@ static Dispatcher *ms_dispatcher_instance = 0;
Dispatcher::Dispatcher (Plugin *parent, bool standalone)
: Plugin (parent, standalone),
m_menu (this),
mp_menu_parent_widget (0),
mp_delegate (0)
{
@@ -45,13 +44,38 @@ Dispatcher::Dispatcher (Plugin *parent, bool standalone)
}
}
Dispatcher::Dispatcher (QWidget *menu_parent_widget, Plugin *parent, bool standalone)
: Plugin (parent, standalone),
mp_menu_parent_widget (menu_parent_widget),
mp_delegate (0)
{
if (mp_menu_parent_widget) {
mp_menu.reset (new lay::AbstractMenu (this));
}
if (! parent && ! ms_dispatcher_instance) {
ms_dispatcher_instance = this;
}
}
Dispatcher::Dispatcher (DispatcherDelegate *delegate, Plugin *parent, bool standalone)
: Plugin (parent, standalone),
m_menu (this),
mp_menu_parent_widget (0),
mp_delegate (delegate)
{
if (! ms_dispatcher_instance) {
if (! parent && ! ms_dispatcher_instance) {
ms_dispatcher_instance = this;
}
}
Dispatcher::Dispatcher (QWidget *menu_parent_widget, DispatcherDelegate *delegate, Plugin *parent, bool standalone)
: Plugin (parent, standalone),
mp_menu_parent_widget (menu_parent_widget),
mp_delegate (delegate)
{
if (mp_menu_parent_widget) {
mp_menu.reset (new lay::AbstractMenu (this));
}
if (! parent && ! ms_dispatcher_instance) {
ms_dispatcher_instance = this;
}
}
@@ -66,9 +90,11 @@ Dispatcher::~Dispatcher ()
bool
Dispatcher::configure (const std::string &name, const std::string &value)
{
std::vector<lay::ConfigureAction *> ca = m_menu.configure_actions (name);
for (std::vector<lay::ConfigureAction *>::const_iterator a = ca.begin (); a != ca.end (); ++a) {
(*a)->configure (value);
if (mp_menu) {
std::vector<lay::ConfigureAction *> ca = mp_menu->configure_actions (name);
for (std::vector<lay::ConfigureAction *>::const_iterator a = ca.begin (); a != ca.end (); ++a) {
(*a)->configure (value);
}
}
if (mp_delegate) {
+19 -21
View File
@@ -117,6 +117,15 @@ public:
*/
Dispatcher (Plugin *parent = 0, bool standalone = false);
/**
* @brief The constructor
*
* @param menu_parent_widget If not 0, indicates that this is a GUI mode dispatcher providing an abstract menu
* @param parent Usually 0, but a dispatcher may have parents. In this case, the dispatcher is not the actual dispatcher, but the real plugin chain's root is.
* @param standalone The standalone flag passed to the plugin constructor.
*/
Dispatcher (QWidget *menu_parent_widget, Plugin *parent = 0, bool standalone = false);
/**
* @brief The root constructor
*
@@ -124,6 +133,14 @@ public:
*/
Dispatcher (DispatcherDelegate *delegate, Plugin *parent = 0, bool standalone = false);
/**
* @brief The root constructor
*
* @param menu_parent_widget If not 0, indicates that this is a GUI mode dispatcher providing an abstract menu
* @param delegate The notification receiver for dispatcher events
*/
Dispatcher (QWidget *menu_parent_widget, DispatcherDelegate *delegate, Plugin *parent = 0, bool standalone = false);
/**
* @brief Destructor
*/
@@ -207,14 +224,6 @@ public:
return mp_menu_parent_widget;
}
/**
* @brief Gets the parent widget
*/
void set_menu_parent_widget (QWidget *w)
{
mp_menu_parent_widget = w;
}
/**
* @brief Returns true, if the dispatcher supplies a user interface
*/
@@ -227,7 +236,7 @@ public:
*/
AbstractMenu *menu ()
{
return (dispatcher () == this) ? &m_menu : dispatcher ()->menu ();
return (dispatcher () == this) ? mp_menu.get () : dispatcher ()->menu ();
}
protected:
@@ -239,22 +248,11 @@ private:
Dispatcher (const Dispatcher &);
Dispatcher &operator= (const Dispatcher &);
lay::AbstractMenu m_menu;
std::unique_ptr<lay::AbstractMenu> mp_menu;
QWidget *mp_menu_parent_widget;
DispatcherDelegate *mp_delegate;
};
}
namespace tl
{
// disable copy ctor for Dispatcher
template <> struct type_traits<lay::Dispatcher> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif
@@ -157,7 +157,7 @@ EditLineStylesForm::update ()
name = tl::sprintf ("#%d", std::distance (m_styles.begin (), i));
}
QListWidgetItem *item = new QListWidgetItem (icon_from_data (*i), tl::to_qstring (name), mp_ui->style_items);
item->setTextColor (cdis);
item->setForeground (cdis);
}
for (std::vector <lay::LineStyles::iterator>::const_iterator i = iters.begin (); i != iters.end (); ++i) {
if ((*i)->order_index () > 0) {
@@ -181,7 +181,11 @@ EditStipplesForm::update ()
name = tl::sprintf ("#%d", std::distance (m_pattern.begin (), i));
}
QListWidgetItem *item = new QListWidgetItem (icon_from_data (i->pattern ()), tl::to_qstring (name), mp_ui->stipple_items);
#if QT_VERSION >= 0x60000
item->setForeground (cdis);
#else
item->setTextColor (cdis);
#endif
}
for (std::vector <lay::DitherPattern::iterator>::const_iterator i = iters.begin (); i != iters.end (); ++i) {
if ((*i)->order_index () > 0) {
@@ -37,7 +37,7 @@ EditorOptionsFrame::EditorOptionsFrame (QWidget *parent)
setObjectName (QString::fromUtf8 ("editor_options_frame"));
QVBoxLayout *left_frame_ly = new QVBoxLayout (this);
left_frame_ly->setMargin (0);
left_frame_ly->setContentsMargins (0, 0, 0, 0);
left_frame_ly->setSpacing (0);
}
@@ -53,7 +53,7 @@ EditorOptionsPages::EditorOptionsPages (QWidget *parent, const std::vector<lay::
: QFrame (parent), mp_dispatcher (dispatcher)
{
QVBoxLayout *ly1 = new QVBoxLayout (this);
ly1->setMargin (0);
ly1->setContentsMargins (0, 0, 0, 0);
mp_pages = new QTabWidget (this);
mp_pages->setSizePolicy (QSizePolicy (QSizePolicy::Ignored, QSizePolicy::Ignored));
@@ -31,6 +31,7 @@
#include <cstdio>
#include <QDomDocument>
#include <QRegExp>
// #define DEBUG_HIGHLIGHTER
@@ -98,7 +99,7 @@ GenericSyntaxHighlighterRuleStringList::GenericSyntaxHighlighterRuleStringList (
m_min_length = std::numeric_limits<int>::max ();
for (QList<QString>::const_iterator s = sl.begin (); s != sl.end (); ++s) {
m_s.insert (*s);
m_min_length = std::min (m_min_length, s->length ());
m_min_length = std::min (m_min_length, int (s->length ()));
}
}
@@ -175,7 +175,7 @@ HCPCellTreeWidget::mouseDoubleClickEvent (QMouseEvent *event)
void
HCPCellTreeWidget::mousePressEvent (QMouseEvent *event)
{
if (event->button () == Qt::MidButton) {
if (event->button () == Qt::MiddleButton) {
// eat this event.
} else {
QModelIndex index (indexAt (event->pos ()));
@@ -189,7 +189,7 @@ HCPCellTreeWidget::mousePressEvent (QMouseEvent *event)
void
HCPCellTreeWidget::mouseReleaseEvent (QMouseEvent *event)
{
if (event->button () == Qt::MidButton) {
if (event->button () == Qt::MiddleButton) {
QModelIndex index (indexAt (event->pos ()));
if (index.isValid ()) {
emit cell_middle_clicked (index);
@@ -238,7 +238,6 @@ HierarchyControlPanel::HierarchyControlPanel (lay::LayoutView *view, QWidget *pa
mp_search_frame->setBackgroundRole (QPalette::Highlight);
QHBoxLayout *sf_ly = new QHBoxLayout (mp_search_frame);
sf_ly->setMargin (0);
sf_ly->setContentsMargins (0, 0, 0, 0);
sf_ly->setSpacing (0);
@@ -249,7 +248,7 @@ HierarchyControlPanel::HierarchyControlPanel (lay::LayoutView *view, QWidget *pa
mp_search_close_cb->setBackgroundRole (QPalette::Highlight);
mp_search_close_cb->setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Preferred));
QPalette pl (mp_search_close_cb->palette ());
pl.setColor (QPalette::Foreground, pl.color (QPalette::Active, QPalette::HighlightedText));
pl.setColor (QPalette::WindowText, pl.color (QPalette::Active, QPalette::HighlightedText));
mp_search_close_cb->setPalette (pl);
mp_search_close_cb->setMaximumSize (QSize (mp_search_close_cb->maximumSize ().width (), mp_search_close_cb->sizeHint ().height () - 4));
connect (mp_search_close_cb, SIGNAL (clicked ()), this, SLOT (search_editing_finished ()));
+13
View File
@@ -90,8 +90,13 @@ HTMLItemDelegate::set_text_width (int w)
void
HTMLItemDelegate::paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
#if QT_VERSION >= 0x60000
QStyleOptionViewItem option_v4 = option;
#else
QStyleOptionViewItemV4 option_v4 = option;
#endif
initStyleOption (&option_v4, index);
// let the text take all the available space (fixes #144)
option_v4.showDecorationSelected = true;
@@ -140,7 +145,11 @@ HTMLItemDelegate::paint (QPainter *painter, const QStyleOptionViewItem &option,
QSize
HTMLItemDelegate::sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const
{
#if QT_VERSION >= 0x60000
QStyleOptionViewItem option_v4 = option;
#else
QStyleOptionViewItemV4 option_v4 = option;
#endif
initStyleOption (&option_v4, index);
const QAbstractItemView *view = dynamic_cast<const QAbstractItemView *> (option_v4.widget);
@@ -169,7 +178,11 @@ HTMLItemDelegate::editorEvent (QEvent *event, QAbstractItemModel * /*model*/, co
QMouseEvent *mouse_event = static_cast<QMouseEvent *> (event);
#if QT_VERSION >= 0x60000
QStyleOptionViewItem option_v4 = option;
#else
QStyleOptionViewItemV4 option_v4 = option;
#endif
initStyleOption (&option_v4, index);
QTextDocument doc;
@@ -218,7 +218,7 @@ LayerControlPanel::LayerControlPanel (lay::LayoutView *view, db::Manager *manage
setSizePolicy (sp);
QVBoxLayout *l = new QVBoxLayout (this);
l->setMargin (0);
l->setContentsMargins (0, 0, 0, 0);
l->setSpacing (0);
mp_search_frame = new QFrame (this);
@@ -231,7 +231,6 @@ LayerControlPanel::LayerControlPanel (lay::LayoutView *view, db::Manager *manage
mp_search_frame->setBackgroundRole (QPalette::Highlight);
QHBoxLayout *sf_ly = new QHBoxLayout (mp_search_frame);
sf_ly->setMargin (0);
sf_ly->setContentsMargins (0, 0, 0, 0);
sf_ly->setSpacing (0);
@@ -242,7 +241,7 @@ LayerControlPanel::LayerControlPanel (lay::LayoutView *view, db::Manager *manage
mp_search_close_cb->setBackgroundRole (QPalette::Highlight);
mp_search_close_cb->setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Preferred));
QPalette pl (mp_search_close_cb->palette ());
pl.setColor (QPalette::Foreground, pl.color (QPalette::Active, QPalette::HighlightedText));
pl.setColor (QPalette::WindowText, pl.color (QPalette::Active, QPalette::HighlightedText));
mp_search_close_cb->setPalette (pl);
mp_search_close_cb->setMaximumSize (QSize (mp_search_close_cb->maximumSize ().width (), mp_search_close_cb->sizeHint ().height () - 4));
connect (mp_search_close_cb, SIGNAL (clicked ()), this, SLOT (search_editing_finished ()));
@@ -338,7 +337,7 @@ LayerControlPanel::LayerControlPanel (lay::LayoutView *view, db::Manager *manage
l->addWidget (tb);
QHBoxLayout *ltb = new QHBoxLayout (tb);
ltb->setMargin (0);
ltb->setContentsMargins (0, 0, 0, 0);
ltb->setSpacing (0);
tb->setObjectName (QString::fromUtf8 ("lcp_buttons"));
+20 -20
View File
@@ -108,7 +108,7 @@ LCPDitherPalette::LCPDitherPalette (QWidget *parent, const char *name)
int n = 0;
QVBoxLayout *l = new QVBoxLayout (this);
l->setMargin (0);
l->setContentsMargins (0, 0, 0, 0);
l->setSpacing (0);
for (unsigned int i = 0; i < 4; ++i) {
@@ -117,7 +117,7 @@ LCPDitherPalette::LCPDitherPalette (QWidget *parent, const char *name)
f->setObjectName (QString::fromUtf8 ("dp_f"));
l->addWidget (f);
QHBoxLayout *ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
for (unsigned int j = 0; j < 4; ++j) {
@@ -151,7 +151,7 @@ LCPDitherPalette::LCPDitherPalette (QWidget *parent, const char *name)
f->setObjectName (QString::fromUtf8 ("dp_ll"));
l->addWidget (f);
QHBoxLayout *ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
LCPActiveLabel *b;
@@ -292,7 +292,7 @@ LCPVisibilityPalette::LCPVisibilityPalette (QWidget *parent, const char *name)
setObjectName (QString::fromUtf8 (name));
QVBoxLayout *l = new QVBoxLayout (this);
l->setMargin (0);
l->setContentsMargins (0, 0, 0, 0);
l->setSpacing (0);
QFrame *f;
@@ -307,7 +307,7 @@ LCPVisibilityPalette::LCPVisibilityPalette (QWidget *parent, const char *name)
f->setObjectName (QString::fromUtf8 ("vis_f"));
l->addWidget (f);
ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
b = new LCPActiveLabel (0, f);
@@ -331,7 +331,7 @@ LCPVisibilityPalette::LCPVisibilityPalette (QWidget *parent, const char *name)
f = new QFrame (this);
l->addWidget (f);
ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
b = new LCPActiveLabel (2, f);
@@ -376,7 +376,7 @@ LCPAnimationPalette::LCPAnimationPalette (QWidget *parent, const char *name)
setObjectName (QString::fromUtf8 (name));
QVBoxLayout *l = new QVBoxLayout (this);
l->setMargin (0);
l->setContentsMargins (0, 0, 0, 0);
l->setSpacing (0);
QFrame *f;
@@ -391,7 +391,7 @@ LCPAnimationPalette::LCPAnimationPalette (QWidget *parent, const char *name)
f->setObjectName (QString::fromUtf8 ("anim_f"));
l->addWidget (f);
ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
b = new LCPActiveLabel (0, f);
@@ -415,7 +415,7 @@ LCPAnimationPalette::LCPAnimationPalette (QWidget *parent, const char *name)
f = new QFrame (this);
l->addWidget (f);
ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
b = new LCPActiveLabel (2, f);
@@ -452,7 +452,7 @@ LCPStylePalette::LCPStylePalette (QWidget *parent, const char *name)
setObjectName (QString::fromUtf8 (name));
QVBoxLayout *l = new QVBoxLayout (this);
l->setMargin (0);
l->setContentsMargins (0, 0, 0, 0);
l->setSpacing (0);
QFrame *f;
@@ -466,7 +466,7 @@ LCPStylePalette::LCPStylePalette (QWidget *parent, const char *name)
f = new QFrame (this);
l->addWidget (f);
ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
for (int i = 0; i < 4; ++i) {
@@ -489,7 +489,7 @@ LCPStylePalette::LCPStylePalette (QWidget *parent, const char *name)
f->setObjectName (QString::fromUtf8 ("ls_ll"));
l->addWidget (f);
ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
// No style
@@ -523,7 +523,7 @@ LCPStylePalette::LCPStylePalette (QWidget *parent, const char *name)
f->setObjectName (QString::fromUtf8 ("style_f"));
l->addWidget (f);
ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
b = new LCPActiveLabel (0, f);
@@ -561,7 +561,7 @@ LCPStylePalette::LCPStylePalette (QWidget *parent, const char *name)
f = new QFrame (this);
l->addWidget (f);
ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
b = new LCPActiveLabel (200, f);
@@ -583,7 +583,7 @@ LCPStylePalette::LCPStylePalette (QWidget *parent, const char *name)
f = new QFrame (this);
l->addWidget (f);
ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
b = new LCPActiveLabel (100, f);
@@ -716,7 +716,7 @@ LCPColorPalette::LCPColorPalette (QWidget *parent, const char *name)
sp.setVerticalStretch (0);
QVBoxLayout *l = new QVBoxLayout (this);
l->setMargin (0);
l->setContentsMargins (0, 0, 0, 0);
l->setSpacing (0);
for (unsigned int i = 0; i < 6; ++i) {
@@ -724,7 +724,7 @@ LCPColorPalette::LCPColorPalette (QWidget *parent, const char *name)
f->setObjectName (QString::fromUtf8 ("color_f"));
l->addWidget (f);
QHBoxLayout *ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
for (unsigned int j = 0; j < 7; ++j) {
@@ -754,7 +754,7 @@ LCPColorPalette::LCPColorPalette (QWidget *parent, const char *name)
f->setObjectName (QString::fromUtf8 ("color_l1"));
l->addWidget (f);
QHBoxLayout *ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
LCPActiveLabel *b;
@@ -784,7 +784,7 @@ LCPColorPalette::LCPColorPalette (QWidget *parent, const char *name)
f->setObjectName (QString::fromUtf8 ("color_l2"));
l->addWidget (f);
QHBoxLayout *ll = new QHBoxLayout (f);
ll->setMargin (0);
ll->setContentsMargins (0, 0, 0, 0);
ll->setSpacing (0);
LCPActiveLabel *b;
@@ -956,7 +956,7 @@ LayerToolbox::add_panel (QWidget *panel_widget, const char *text)
b->setFocusPolicy (Qt::NoFocus);
b->setBackgroundRole (QPalette::Highlight);
QPalette pl (b->palette ());
pl.setColor (QPalette::Foreground, pl.color (QPalette::Active, QPalette::HighlightedText));
pl.setColor (QPalette::WindowText, pl.color (QPalette::Active, QPalette::HighlightedText));
b->setPalette (pl);
b->setText (tl::to_qstring (text));
b->setMaximumSize (QSize (b->maximumSize ().width (), b->sizeHint ().height () - 4));
+1 -1
View File
@@ -851,7 +851,7 @@ LayerTreeModel::data (const QModelIndex &index, int role) const
return QVariant ();
}
} else if (role == Qt::TextColorRole || role == Qt::FontRole) {
} else if (role == Qt::ForegroundRole || role == Qt::FontRole) {
if (index.column () == 1) {
+1 -1
View File
@@ -303,7 +303,7 @@ LayoutCanvas::LayoutCanvas (QWidget *parent, lay::LayoutView *view, const char *
mp_redraw_thread = new lay::RedrawThread (this, view);
setBackgroundRole (QPalette::NoRole);
set_colors (palette ().color (QPalette::Normal, QPalette::Background),
set_colors (palette ().color (QPalette::Normal, QPalette::Window),
palette ().color (QPalette::Normal, QPalette::Text),
palette ().color (QPalette::Normal, QPalette::Mid));
setAttribute (Qt::WA_NoSystemBackground);
@@ -138,7 +138,11 @@ public:
: mp_layout (layout)
{
QResource res (QString::fromUtf8 (":/st/") + url.path ());
if (res.isCompressed ()) {
#if QT_VERSION >= 0x60000
if (res.compressionAlgorithm () == QResource::ZlibCompression) {
#else
if (res.isCompressed ()) {
#endif
m_temp = qUncompress ((const unsigned char *)res.data (), (int)res.size ());
} else {
m_temp = QByteArray ((const char *)res.data (), (int)res.size ());
+6 -7
View File
@@ -252,7 +252,7 @@ static LayoutView *ms_current = 0;
LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin_parent, QWidget *parent, const char *name, unsigned int options)
: QFrame (parent),
lay::Dispatcher (plugin_parent, false /*not standalone*/),
lay::Dispatcher (this, plugin_parent, false /*not standalone*/),
m_editable (editable),
m_options (options),
m_annotation_shapes (manager),
@@ -261,7 +261,6 @@ LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin
{
// either it's us or the parent has a dispatcher
tl_assert (dispatcher () != 0);
set_menu_parent_widget (this);
// ensures the deferred method scheduler is present
tl::DeferredMethodScheduler::instance ();
@@ -470,7 +469,7 @@ LayoutView::init (db::Manager *mgr, QWidget * /*parent*/)
m_current_layer_list = 0;
QVBoxLayout *vbl = new QVBoxLayout (this);
vbl->setMargin (0);
vbl->setContentsMargins (0, 0, 0, 0);
vbl->setSpacing (0);
mp_canvas = new lay::LayoutCanvas (this, this);
@@ -490,7 +489,7 @@ LayoutView::init (db::Manager *mgr, QWidget * /*parent*/)
hierarchy_frame->setObjectName (QString::fromUtf8 ("left"));
mp_hierarchy_frame = hierarchy_frame;
QVBoxLayout *left_frame_ly = new QVBoxLayout (hierarchy_frame);
left_frame_ly->setMargin (0);
left_frame_ly->setContentsMargins (0, 0, 0, 0);
left_frame_ly->setSpacing (0);
mp_hierarchy_panel = new lay::HierarchyControlPanel (this, hierarchy_frame, "hcp");
@@ -504,7 +503,7 @@ LayoutView::init (db::Manager *mgr, QWidget * /*parent*/)
levels_frame->setObjectName (QString::fromUtf8 ("lvl_frame"));
left_frame_ly->addWidget (levels_frame);
QHBoxLayout *levels_frame_ly = new QHBoxLayout (levels_frame);
levels_frame_ly->setMargin (1);
levels_frame_ly->setContentsMargins (1, 1, 1, 1);
QLabel *level_l1 = new QLabel (tl::to_qstring (" " + tl::to_string (QObject::tr ("Levels"))), levels_frame);
levels_frame_ly->addWidget (level_l1);
mp_min_hier_spbx = new QSpinBox (levels_frame);
@@ -537,7 +536,7 @@ LayoutView::init (db::Manager *mgr, QWidget * /*parent*/)
bookmarks_frame->setObjectName (QString::fromUtf8 ("bookmarks_frame"));
mp_bookmarks_frame = bookmarks_frame;
QVBoxLayout *left_frame_ly = new QVBoxLayout (bookmarks_frame);
left_frame_ly->setMargin (0);
left_frame_ly->setContentsMargins (0, 0, 0, 0);
left_frame_ly->setSpacing (0);
mp_bookmarks_view = new lay::BookmarksView (this, bookmarks_frame, "bookmarks");
@@ -552,7 +551,7 @@ LayoutView::init (db::Manager *mgr, QWidget * /*parent*/)
mp_libraries_frame = new QFrame (0);
mp_libraries_frame->setObjectName (QString::fromUtf8 ("libs_frame"));
QVBoxLayout *left_frame_ly = new QVBoxLayout (mp_libraries_frame);
left_frame_ly->setMargin (0);
left_frame_ly->setContentsMargins (0, 0, 0, 0);
left_frame_ly->setSpacing (0);
mp_libraries_view = new lay::LibrariesView (this, mp_libraries_frame, "libs");
-8
View File
@@ -2934,12 +2934,4 @@ private:
}
namespace tl {
template <> struct type_traits<lay::LayoutView> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif
+3 -4
View File
@@ -165,7 +165,7 @@ LibraryTreeWidget::mouseDoubleClickEvent (QMouseEvent *event)
void
LibraryTreeWidget::mousePressEvent (QMouseEvent *event)
{
if (event->button () == Qt::MidButton) {
if (event->button () == Qt::MiddleButton) {
// eat this event.
} else {
QModelIndex index (indexAt (event->pos ()));
@@ -179,7 +179,7 @@ LibraryTreeWidget::mousePressEvent (QMouseEvent *event)
void
LibraryTreeWidget::mouseReleaseEvent (QMouseEvent *event)
{
if (event->button () == Qt::MidButton) {
if (event->button () == Qt::MiddleButton) {
QModelIndex index (indexAt (event->pos ()));
if (index.isValid ()) {
emit cell_middle_clicked (index);
@@ -225,7 +225,6 @@ LibrariesView::LibrariesView (lay::LayoutView *view, QWidget *parent, const char
mp_search_frame->setBackgroundRole (QPalette::Highlight);
QHBoxLayout *sf_ly = new QHBoxLayout (mp_search_frame);
sf_ly->setMargin (0);
sf_ly->setContentsMargins (0, 0, 0, 0);
sf_ly->setSpacing (0);
@@ -236,7 +235,7 @@ LibrariesView::LibrariesView (lay::LayoutView *view, QWidget *parent, const char
mp_search_close_cb->setBackgroundRole (QPalette::Highlight);
mp_search_close_cb->setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Preferred));
QPalette pl (mp_search_close_cb->palette ());
pl.setColor (QPalette::Foreground, pl.color (QPalette::Active, QPalette::HighlightedText));
pl.setColor (QPalette::WindowText, pl.color (QPalette::Active, QPalette::HighlightedText));
mp_search_close_cb->setPalette (pl);
mp_search_close_cb->setMaximumSize (QSize (mp_search_close_cb->maximumSize ().width (), mp_search_close_cb->sizeHint ().height () - 4));
connect (mp_search_close_cb, SIGNAL (clicked ()), this, SLOT (search_editing_finished ()));
@@ -326,7 +326,7 @@ SpecificLoadLayoutOptionsDialog::SpecificLoadLayoutOptionsDialog (QWidget *paren
QVBoxLayout *layout = new QVBoxLayout (mp_ui->content_frame);
layout->addWidget (mp_editor);
layout->setMargin (0);
layout->setContentsMargins (0, 0, 0, 0);
mp_ui->content_frame->setLayout (layout);
mp_editor->show ();
-13
View File
@@ -813,17 +813,4 @@ private:
}
namespace tl {
template <> struct type_traits<lay::Marker> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template <> struct type_traits<lay::DMarker> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif
+5 -15
View File
@@ -99,19 +99,6 @@ class CircuitNetItemData;
class CircuitDeviceItemData;
class CircuitSubCircuitItemData;
}
namespace tl {
// disable copying for NetlistModelItemData
template<> struct type_traits<lay::NetlistModelItemData>
{
typedef false_tag has_copy_constructor;
};
}
namespace lay
{
/**
* @brief A base class for the item data object
*/
@@ -119,7 +106,7 @@ class NetlistModelItemData
: public tl::list_node<NetlistModelItemData>
{
public:
typedef tl::list<NetlistModelItemData>::iterator iterator;
typedef tl::list<NetlistModelItemData, false>::iterator iterator;
NetlistModelItemData ();
NetlistModelItemData (NetlistModelItemData *parent);
@@ -168,8 +155,11 @@ public:
bool derived_from_nets (const std::pair<const db::Net *, const db::Net *> &np);
private:
NetlistModelItemData (const NetlistModelItemData &);
NetlistModelItemData &operator= (const NetlistModelItemData &);
NetlistModelItemData *mp_parent;
tl::list<NetlistModelItemData> m_children;
tl::list<NetlistModelItemData, false> m_children;
std::vector<NetlistModelItemData *> m_children_per_index;
bool m_children_made;
size_t m_index;
@@ -720,7 +720,7 @@ static QModelIndex find_next (QTreeView *view, QAbstractItemModel *model, const
if (has_next) {
QString text = model->data (current, Qt::UserRole).toString ();
if (text.indexOf (to_find) >= 0 && ! view->isRowHidden (rows_stack.back ().first, parent_stack.back ())) {
if (to_find.indexIn (text) >= 0 && ! view->isRowHidden (rows_stack.back ().first, parent_stack.back ())) {
return current;
}
-8
View File
@@ -883,14 +883,6 @@ inline bool test_and_set (T &target, const T &source)
}
namespace tl
{
// disable copy ctor for Plugin
template <> struct type_traits<lay::Plugin> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
#endif
@@ -61,11 +61,11 @@ void
SelectCellViewForm::set_selection (int sel)
{
for (int i = 0; i < int (cvs_lb->count ()); ++i) {
cvs_lb->setItemSelected (cvs_lb->item (i), false);
cvs_lb->item (i)->setSelected (false);
}
if (sel >= 0 && sel < int (cvs_lb->count ())) {
cvs_lb->setCurrentItem (cvs_lb->item (sel));
cvs_lb->setItemSelected (cvs_lb->item (sel), true);
cvs_lb->item (sel)->setSelected (true);
}
}
@@ -86,14 +86,14 @@ SelectCellViewForm::tell_cellview (const lay::CellView &cv)
{
cvs_lb->addItem (tl::to_qstring (cv->name ()));
cvs_lb->setCurrentItem (0);
cvs_lb->setItemSelected (cvs_lb->item (0), true);
cvs_lb->item (0)->setSelected (true);
}
bool
SelectCellViewForm::all_selected () const
{
for (int i = 0; i < int (cvs_lb->count ()); ++i) {
if (! cvs_lb->isItemSelected (cvs_lb->item (i))) {
if (! cvs_lb->item (i)->isSelected ()) {
return false;
}
}
@@ -106,7 +106,7 @@ SelectCellViewForm::selected_cellviews () const
std::vector <int> res;
for (int i = 0; i < int (cvs_lb->count ()); ++i) {
if (cvs_lb->isItemSelected (cvs_lb->item (i))) {
if (cvs_lb->item (i)->isSelected ()) {
res.push_back (i);
}
}
@@ -118,7 +118,7 @@ int
SelectCellViewForm::selected_cellview () const
{
for (int i = 0; i < int (cvs_lb->count ()); ++i) {
if (cvs_lb->isItemSelected (cvs_lb->item (i))) {
if (cvs_lb->item (i)->isSelected ()) {
return i;
}
}
+25 -8
View File
@@ -133,7 +133,7 @@ qt_to_buttons (Qt::MouseButtons b, Qt::KeyboardModifiers m)
// BTW: On a MAC's keyboard, the cmd-key is received here as a ControlModifier
// while the ctrl-key is received as a MetaModifier
return ((b & Qt::LeftButton) ? ((m & Qt::MetaModifier) ? RightButton : LeftButton) : 0) |
((b & Qt::MidButton) ? MidButton : 0) |
((b & Qt::MiddleButton) ? MidButton : 0) |
((b & Qt::RightButton) ? RightButton : 0) |
((m & Qt::ShiftModifier) != 0 ? ShiftButton : 0) |
((m & Qt::ControlModifier) != 0 ? ControlButton : 0) |
@@ -684,7 +684,11 @@ END_PROTECTED
}
void
#if QT_VERSION >= 0x60000
ViewObjectWidget::enterEvent (QEnterEvent * /*event*/)
#else
ViewObjectWidget::enterEvent (QEvent * /*event*/)
#endif
{
BEGIN_PROTECTED
m_mouse_inside = true;
@@ -764,36 +768,43 @@ BEGIN_PROTECTED
ensure_entered ();
begin_mouse_event ();
#if QT_VERSION < 0x60000
int delta = e->delta ();
db::DPoint p = pixel_to_um (e->pos ());
bool horizontal = (e->orientation () == Qt::Horizontal);
#else
int delta = e->angleDelta ().y ();
db::DPoint p = pixel_to_um (e->position ());
bool horizontal = false;
#endif
e->ignore ();
bool done = false;
unsigned int buttons = qt_to_buttons (e->buttons (), e->modifiers ());
bool horizontal = (e->orientation () == Qt::Horizontal);
db::DPoint p = pixel_to_um (e->pos ());
for (std::list<ViewService *>::iterator g = m_grabbed.begin (); !done && g != m_grabbed.end (); ) {
std::list<ViewService *>::iterator gg = g;
++gg;
done = ((*g)->enabled () && (*g)->wheel_event (e->delta (), horizontal, p, buttons, true));
done = ((*g)->enabled () && (*g)->wheel_event (delta, horizontal, p, buttons, true));
g = gg;
}
if (! done && mp_active_service) {
done = (mp_active_service->enabled () && mp_active_service->wheel_event (e->delta (), horizontal, p, buttons, true));
done = (mp_active_service->enabled () && mp_active_service->wheel_event (delta, horizontal, p, buttons, true));
}
service_iterator svc = begin_services ();
while (svc != end_services () && !done) {
service_iterator next = svc;
++next;
done = ((*svc)->enabled () && (*svc)->wheel_event (e->delta (), horizontal, p, buttons, false));
done = ((*svc)->enabled () && (*svc)->wheel_event (delta, horizontal, p, buttons, false));
svc = next;
}
if (! done) {
wheel_event (e->delta (), horizontal, p, buttons);
wheel_event (delta, horizontal, p, buttons);
}
end_mouse_event ();
@@ -879,6 +890,12 @@ ViewObjectWidget::pixel_to_um (const QPoint &pt) const
return m_trans.inverted () * db::DPoint (pt.x (), height () - 1 - pt.y ());
}
db::DPoint
ViewObjectWidget::pixel_to_um (const QPointF &pt) const
{
return m_trans.inverted () * db::DPoint (pt.x (), height () - 1 - pt.y ());
}
void
ViewObjectWidget::mouse_event_trans (const db::DCplxTrans &trans)
{
+9
View File
@@ -1002,6 +1002,11 @@ public:
*/
db::DPoint pixel_to_um (const QPoint &pt) const;
/**
* @brief Translates a screen coordinate in micrometer coordinates
*/
db::DPoint pixel_to_um (const QPointF &pt) const;
/**
* @brief Gets a flag indicating whether the mouse is inside the window
*/
@@ -1034,7 +1039,11 @@ protected:
/**
* @brief Qt mouse enter event handler
*/
#if QT_VERSION >= 0x60000
void enterEvent (QEnterEvent *e);
#else
void enterEvent (QEvent *e);
#endif
/**
* @brief Qt mouse button press event handler
+11 -14
View File
@@ -1009,10 +1009,9 @@ DecoratedLineEdit::DecoratedLineEdit (QWidget *parent)
mp_clear_label->setCursor (Qt::ArrowCursor);
mp_clear_label->setPixmap (QString::fromUtf8 (":/clear_edit.png"));
int l = 0, t = 0, r = 0, b = 0;
getTextMargins (&l, &t, &r, &b);
m_default_left_margin = l;
m_default_right_margin = r;
QMargins margins = textMargins ();
m_default_left_margin = margins.left ();
m_default_right_margin = margins.right ();
}
DecoratedLineEdit::~DecoratedLineEdit ()
@@ -1079,14 +1078,13 @@ void DecoratedLineEdit::set_clear_button_enabled (bool en)
m_clear_button_enabled = en;
mp_clear_label->setVisible (en);
int l = 0, t = 0, r = 0, b = 0;
getTextMargins (&l, &t, &r, &b);
QMargins margins = textMargins ();
if (! en) {
r = m_default_right_margin;
margins.setRight (m_default_right_margin);
} else {
r = m_default_right_margin + mp_clear_label->sizeHint ().width () + le_decoration_space;
margins.setRight (m_default_right_margin + mp_clear_label->sizeHint ().width () + le_decoration_space);
}
setTextMargins (l, t, r, b);
setTextMargins (margins);
resizeEvent (0);
@@ -1100,14 +1098,13 @@ void DecoratedLineEdit::set_options_button_enabled (bool en)
m_options_button_enabled = en;
mp_options_label->setVisible (en);
int l = 0, t = 0, r = 0, b = 0;
getTextMargins (&l, &t, &r, &b);
QMargins margins = textMargins ();
if (! en) {
l = m_default_left_margin;
margins.setLeft (m_default_left_margin);
} else {
l = m_default_left_margin + mp_options_label->sizeHint ().width () + le_decoration_space;
margins.setLeft (m_default_left_margin + mp_options_label->sizeHint ().width () + le_decoration_space);
}
setTextMargins (l, t, r, b);
setTextMargins (margins);
resizeEvent (0);