Skip to content

Commit

Permalink
add ellipse to long set names and paths + reorganize set edit dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Jan 6, 2014
1 parent 991e938 commit c3efd51
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 37 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ A: There are two kind of hotkeys: the ones defined in the "Options" dialog allow
The ones defined in the set edit dialog allow to change the current set. You can assign the same hotkey to multiple sets.
In both cases, click on the input box and press the desired keys combinination. You must at least use one modifier (Ctrl, Shift, Alt, Win) and some keys are not available (Esc, Tab, Backspace, ...). Press Esc or Backspace to clear the hotkey.

A: Hotkeys allows you two quickly change witch set is activated from the keyboard even when the application window is hidden. You can configure which keys must be pressed in the "Options" menu. Say you choosed Shift+Ctrl, press Shift+Ctrl+1 to activate the first set, Shift+Ctrl+2 for the second set, and so on. Only the 9 first sets can be activated from the keyboard.

Q: Can I reorder sets ?
A: Yes. Simply drag & drop them.

Expand Down
12 changes: 8 additions & 4 deletions src/listdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void ListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option,


// TITLE
rect = option.rect.adjusted(20, 1, 0, 0);
rect = option.rect.adjusted(20, 1, -25, 0);
painter->setFont(QFont("Calibri", 11));
if (selected)
{
Expand All @@ -102,10 +102,12 @@ void ListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option,
{
painter->setPen(QColor(51,51,51));
}
painter->drawText(rect, Qt::AlignTop|Qt::AlignLeft, poSet->fullName(), &rect);

QString title = QFontMetrics(painter->font()).elidedText(poSet->fullName(), Qt::ElideMiddle, rect.width());
painter->drawText(rect, Qt::AlignTop|Qt::AlignLeft, title, &rect);

// PATH
rect = option.rect.adjusted(20, 19, 0, 0);
rect = option.rect.adjusted(20, 19, -25, 0);
painter->setFont(QFont("Calibri", 9, -1, true));
if (selected)
{
Expand All @@ -115,5 +117,7 @@ void ListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option,
{
painter->setPen(Qt::darkGray);
}
painter->drawText(rect, Qt::AlignTop|Qt::AlignLeft, poSet->path(), &rect);

QString path = QFontMetrics(painter->font()).elidedText(poSet->path(), Qt::ElideMiddle, rect.width());
painter->drawText(rect, Qt::AlignTop|Qt::AlignLeft, path, &rect);
}
88 changes: 57 additions & 31 deletions src/seteditdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
<rect>
<x>0</x>
<y>0</y>
<width>240</width>
<height>151</height>
<width>250</width>
<height>160</height>
</rect>
</property>
<property name="windowTitle">
<string>Properties</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0,1">
<item row="1" column="1" colspan="3">
<widget class="QLineEdit" name="m_poNameInput"/>
</item>
<item row="3" column="1">
<item row="3" column="1" colspan="3">
<widget class="QComboBox" name="m_poTypeSelect"/>
</item>
<item row="8" column="1">
<item row="9" column="0" colspan="4">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand All @@ -33,22 +33,6 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="m_poStyleSelect"/>
</item>
<item row="7" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
Expand All @@ -59,39 +43,81 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<item row="1" column="0">
<widget class="QLabel" name="label_1">
<property name="text">
<string>Style :</string>
<string>Name :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_1">
<item row="6" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Name :</string>
<string>Hotkey :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="0" colspan="2">
<widget class="QComboBox" name="m_poStyleSelect"/>
</item>
<item row="7" column="2" colspan="2">
<widget class="QLineEditHotkey" name="m_poHotkeyInput"/>
</item>
<item row="6" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Hotkey :</string>
<string>Style :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
Expand Down

0 comments on commit c3efd51

Please sign in to comment.