Merge PR #998: Add a find() method to SerialPorts
This commit is contained in:
commit
0346a7b1ca
@ -99,6 +99,16 @@ void SerialPorts::clear()
|
|||||||
emit countChanged();
|
emit countChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SerialPort *SerialPorts::find(const QString &systemLocation) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_serialPorts.count(); i++) {
|
||||||
|
if (m_serialPorts.at(i)->systemLocation() == systemLocation) {
|
||||||
|
return m_serialPorts.at(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
SerialPort *SerialPorts::get(int index) const
|
SerialPort *SerialPorts::get(int index) const
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= m_serialPorts.count()) {
|
if (index < 0 || index >= m_serialPorts.count()) {
|
||||||
|
|||||||
@ -62,6 +62,7 @@ public:
|
|||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
Q_INVOKABLE SerialPort *find(const QString &systemLocation) const;
|
||||||
Q_INVOKABLE virtual SerialPort *get(int index) const;
|
Q_INVOKABLE virtual SerialPort *get(int index) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@ -90,7 +90,7 @@ ItemDelegate {
|
|||||||
|
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
id: innerLayout
|
id: innerLayout
|
||||||
spacing: app.margins
|
spacing: Style.margins
|
||||||
Item {
|
Item {
|
||||||
Layout.preferredHeight: root.iconSize
|
Layout.preferredHeight: root.iconSize
|
||||||
Layout.preferredWidth: height
|
Layout.preferredWidth: height
|
||||||
@ -140,7 +140,7 @@ ItemDelegate {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
text: root.subText
|
text: root.subText
|
||||||
font.pixelSize: root.prominentSubText ? app.smallFont : app.extraSmallFont
|
font.pixelSize: root.prominentSubText ? Style.smallFont : app.extraSmallFont
|
||||||
color: root.prominentSubText ? Material.foreground : Material.color(Material.Grey)
|
color: root.prominentSubText ? Material.foreground : Material.color(Material.Grey)
|
||||||
wrapMode: root.wrapTexts ? Text.WordWrap : Text.NoWrap
|
wrapMode: root.wrapTexts ? Text.WordWrap : Text.NoWrap
|
||||||
maximumLineCount: root.wrapTexts ? 2 : 1
|
maximumLineCount: root.wrapTexts ? 2 : 1
|
||||||
@ -159,7 +159,7 @@ ItemDelegate {
|
|||||||
id: secondaryIconMouseArea
|
id: secondaryIconMouseArea
|
||||||
enabled: false
|
enabled: false
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: -app.margins
|
anchors.margins: -Style.margins
|
||||||
onClicked: root.secondaryIconClicked();
|
onClicked: root.secondaryIconClicked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user