Changeset 99c2b0


Ignore:
Timestamp:
01/13/12 16:47:20 (4 months ago)
Author:
Micke Prag <micke.prag@…>
Branches:
('master', 'deebf2045e7119c339412580f37a1e653f7d5715')('controller-upgrade', '00f95d22e12d96ef089e0902ef62ae8ce841dc6f')
Children:
1e650c7142f7844537be880bdfa4b4229880b6ad
Parents:
64e2b354af0c1166afff3ea763e1c12b6b1be779
git-author:
Micke Prag <micke.prag@telldus.se>2012-01-13 16:47:20+01:00
git-committer:
Micke Prag <micke.prag@telldus.se>2012-01-13 16:47:20+01:00
Message:

Convert the textbox to qt-components as well

Location:
telldus-gui/Plugins/Sensors
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • telldus-gui/Plugins/Sensors/SensorView.qml

    r64e2b3 r99c2b0  
    99                height: childrenRect.height 
    1010                width: parent.width 
     11 
     12                property string state: main.state 
     13                onStateChanged: { 
     14                        if (state != "EDIT") { 
     15                                modelData.setName(nameEdit.text) 
     16                        } 
     17                } 
    1118 
    1219                BorderImage { 
     
    2330                                height: 40 
    2431                                verticalAlignment: Text.AlignVCenter 
    25                                 text: modelData.name; 
     32                                text: modelData.name == '' ? '<unnamed>' : modelData.name; 
    2633                                color: "#004275" 
    2734                        } 
    28                         Rectangle{ 
    29                                 color: "white" 
     35                        TextField { 
     36                                id: nameEdit 
    3037                                visible: main.state == "EDIT" 
    3138                                anchors.left: parent.left 
    3239                                anchors.leftMargin: 15 
    33                                 width: nameEdit.width + 4 
    34                                 height: 22 
    35                                 TextInput{ 
    36                                         id: nameEdit 
    37                                         anchors.centerIn: parent 
    38                                         text: modelData.name; 
    39                                         color: "#004275" 
    40  
    41                                         onActiveFocusChanged: { 
    42                                                 if(!activeFocus){ 
    43                                                         //todo other way? 
    44                                                         modelData.setName(nameEdit.text); 
    45                                                 } 
    46                                         } 
    47                                         onAccepted: { 
    48                                                 modelData.setName(nameEdit.text); 
    49                                         } 
    50                                 } 
     40                                anchors.top: parent.top 
     41                                anchors.topMargin: (40-nameEdit.height)/2 
     42                                text: modelData.name; 
     43                                placeholderText: 'Enter a name' 
    5144                        } 
    5245                        Text{ 
  • telldus-gui/Plugins/Sensors/sensor.cpp

    ref9a20 r99c2b0  
    4747 
    4848QString Sensor::name() const { 
    49         //return QString("%1 %2").arg(this->protocol()).arg(this->id()); //TODO: Remove when name is fully implemented 
    50         if(d->name == ""){ 
    51                 return "<unnamed>"; 
    52         } 
    5349        return d->name; 
    5450} 
Note: See TracChangeset for help on using the changeset viewer.