Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 247ec3c

Browse files
finalizandoLógicaLista
1 parent 945594d commit 247ec3c

File tree

3 files changed

+41
-49
lines changed

3 files changed

+41
-49
lines changed

‎.idea/workspace.xml

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lista.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,28 @@ def excluir():
1515
def limpar():
1616
tela_lista.listWidget.clear()
1717

18-
# *********************
19-
# ponto de controle: implementar função marcar
20-
# def marcar():
21-
# print('Marcado!')
22-
# item = tela_lista.listWidget.takeItem(tela_lista.listWidget.currentRow())
23-
# riscado = item.text()
24-
# item = None
25-
# print('item None ok')
26-
# print(riscado)
27-
# tela_lista.listWidget.takeItem(tela_lista.listWidget.currentRow(addItem('teste')))
28-
29-
30-
# riscado = riscado.setStrikeOut(True)
31-
# item.setFont(riscado)
32-
# print(item.font())
33-
# f = item.font()
34-
# f.setStrikeOut(True)
35-
# item.setFont(f)
36-
# font('text-decoration: line-through')
37-
3818

19+
def marcar():
20+
try:
21+
item = tela_lista.listWidget.takeItem(tela_lista.listWidget.currentRow())
22+
f = item.font()
23+
f.setStrikeOut(True)
24+
item.setFont(f)
25+
texto = item
26+
item = None
27+
tela_lista.listWidget.insertItem(tela_lista.listWidget.currentRow(), texto)
28+
except:
29+
pass
30+
31+
32+
def desmarcar():
33+
try:
34+
item = tela_lista.listWidget.takeItem(tela_lista.listWidget.currentRow())
35+
texto = item.text()
36+
item = None
37+
tela_lista.listWidget.insertItem(tela_lista.listWidget.currentRow(), texto)
38+
except:
39+
pass
3940

4041

4142
app = QtWidgets.QApplication([])
@@ -47,6 +48,7 @@ def limpar():
4748
tela_lista.btn_excluir.clicked.connect(excluir)
4849
tela_lista.btn_limpar.clicked.connect(limpar)
4950
tela_lista.btn_marcar.clicked.connect(marcar)
51+
tela_lista.btn_desmarcar.clicked.connect(desmarcar)
5052

5153
tela_lista.show()
5254
app.exec()

‎tela_lista.ui

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,6 @@
2323
<height>192</height>
2424
</rect>
2525
</property>
26-
<item>
27-
<property name="text">
28-
<string>New Item1</string>
29-
</property>
30-
</item>
31-
<item>
32-
<property name="text">
33-
<string>New Item2</string>
34-
</property>
35-
</item>
36-
<item>
37-
<property name="text">
38-
<string>New Item3</string>
39-
</property>
40-
</item>
41-
<item>
42-
<property name="text">
43-
<string>New Item4</string>
44-
</property>
45-
</item>
46-
<item>
47-
<property name="text">
48-
<string/>
49-
</property>
50-
</item>
5126
</widget>
5227
<widget class="QLineEdit" name="lineEdit">
5328
<property name="geometry">
@@ -62,7 +37,7 @@
6237
<widget class="QPushButton" name="btn_adicionar">
6338
<property name="geometry">
6439
<rect>
65-
<x>90</x>
40+
<x>10</x>
6641
<y>310</y>
6742
<width>75</width>
6843
<height>23</height>
@@ -88,7 +63,7 @@
8863
<widget class="QPushButton" name="btn_marcar">
8964
<property name="geometry">
9065
<rect>
91-
<x>170</x>
66+
<x>90</x>
9267
<y>310</y>
9368
<width>75</width>
9469
<height>23</height>
@@ -111,6 +86,19 @@
11186
<string>Limpar</string>
11287
</property>
11388
</widget>
89+
<widget class="QPushButton" name="btn_desmarcar">
90+
<property name="geometry">
91+
<rect>
92+
<x>170</x>
93+
<y>310</y>
94+
<width>75</width>
95+
<height>23</height>
96+
</rect>
97+
</property>
98+
<property name="text">
99+
<string>Desmarcar</string>
100+
</property>
101+
</widget>
114102
</widget>
115103
</widget>
116104
<resources/>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /