mirror of https://github.com/KLayout/klayout.git
Netlist browser: Esc now clears the selection rather than closing the browser window.
This commit is contained in:
parent
6cf4df1cb1
commit
20eb53d626
|
|
@ -312,6 +312,14 @@
|
|||
<string>Export Selected Nets</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUnselectAll">
|
||||
<property name="text">
|
||||
<string>Unselect All</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Esc</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
@ -359,5 +367,21 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionUnselectAll</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>directory_tree</receiver>
|
||||
<slot>clearSelection()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>324</x>
|
||||
<y>289</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include <QPainter>
|
||||
#include <QColorDialog>
|
||||
#include <QRegExp>
|
||||
#include <QKeyEvent>
|
||||
|
||||
namespace lay
|
||||
{
|
||||
|
|
@ -101,9 +102,13 @@ NetlistBrowserPage::NetlistBrowserPage (QWidget * /*parent*/)
|
|||
lay::ColorButton::build_color_menu (menu, this, SLOT (browse_color_for_net ()), SLOT (select_color_for_net ()));
|
||||
color_action->setMenu (menu);
|
||||
|
||||
QAction *sep;
|
||||
directory_tree->addAction (actionCollapseAll);
|
||||
directory_tree->addAction (actionExpandAll);
|
||||
QAction *sep;
|
||||
sep = new QAction (directory_tree);
|
||||
sep->setSeparator (true);
|
||||
directory_tree->addAction (sep);
|
||||
directory_tree->addAction (actionUnselectAll);
|
||||
sep = new QAction (directory_tree);
|
||||
sep->setSeparator (true);
|
||||
directory_tree->addAction (sep);
|
||||
|
|
@ -150,6 +155,8 @@ NetlistBrowserPage::NetlistBrowserPage (QWidget * /*parent*/)
|
|||
|
||||
forward->setEnabled (false);
|
||||
backward->setEnabled (false);
|
||||
|
||||
directory_tree->installEventFilter (this);
|
||||
}
|
||||
|
||||
NetlistBrowserPage::~NetlistBrowserPage ()
|
||||
|
|
@ -211,6 +218,26 @@ NetlistBrowserPage::set_max_shape_count (size_t max_shape_count)
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
NetlistBrowserPage::eventFilter (QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched != directory_tree) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QKeyEvent *ke = dynamic_cast<QKeyEvent *> (event);
|
||||
if (! ke || event->type () != QEvent::KeyPress) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ke->key () == Qt::Key_Escape) {
|
||||
directory_tree->clearSelection ();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NetlistBrowserPage::layer_list_changed (int)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -154,6 +154,9 @@ private slots:
|
|||
void browse_color_for_net ();
|
||||
void select_color_for_net ();
|
||||
|
||||
protected:
|
||||
bool eventFilter (QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
bool m_show_all;
|
||||
QAction *m_show_all_action;
|
||||
|
|
|
|||
Loading…
Reference in New Issue