Today I tried to write this code, but if I pray the button (qpushbutton) does not print anything to console:
am I doing something wrong?
import os
import nimqt
import nimqt/qmainwindow
import nimqt/[qpushbutton, qlineedit, qfiledialog, qspinbox]
import nimqt/tools/toolbar
nimqt.init
let app1 = newQApplication(commandLineParams())
let finestra: ptr QMainWindow = newQMainWindow()
let centrale = newQWidget()
let ledit = newQLineEdit(Q"Prima app in Qt MainWindow")
ledit.setReadOnly(true)
ledit.setDisabled(true)
ledit.setAlignment(newQFlags(Qt_AlignmentFlag.AlignHCenter))
inheritQObject(Bottone, QPushButton):
slot_decl cambia()
proc cambia(this: ptr Bottone) =
ledit.setText(Q"Hello World!!")
let bottone = newBottone()
bottone.setText(Q"Premi Qui")
let toolbar1=finestra.addToolbar(Q"Toolbar 1")
toolbar1.makeToolbar:
- "Apri":
setIcon(newQIcon(Q "Icons/open.png"))
handleTriggered():
let nomeFile = finestra.static_QFileDialog_getOpenFileName()
ledit.setText(nomeFile)
- "Chiudi":
setIcon(newQIcon(Q "Icons/close.png"))
handleTriggered():
quit(0)
- newQPushButton(Q "Premi!"):
setEnabled(true)
handleTriggered():
echo "-------- hellooo ----------" # <--Don't print this message (don't take the call ??)
centrale.makeLayout:
- use_object ledit
- use_object bottone:
connect(SIGNAL "clicked()", bottone, SLOT "cambia()")
finestra.setCentralWidget(centrale)
finestra.setWindowTitle(Q"MainWindow")
finestra.setGeometry(600, 500, 250, 150)
finestra.setWindowIcon(newQIcon(Q "Icons/panoratux.png"))
finestra.show()
discard app1.exec()
he button appears regularly in the toolbar, but by pressing not printing "--- Hello-", is it a bug, or am I using the macro badly?
Good day from Martin A.
Today I tried to write this code, but if I pray the button (qpushbutton) does not print anything to console: am I doing something wrong?
he button appears regularly in the toolbar, but by pressing not printing "--- Hello-", is it a bug, or am I using the macro badly? Good day from Martin A.