Shinmera / qtools

Qtools is a collection of utilities to aid development with CommonQt
https://shinmera.github.io/qtools
zlib License
210 stars 17 forks source link

Consider implementing a basic QT tutorial as example #23

Closed bigos closed 7 years ago

bigos commented 7 years ago

I tried to understand your Readme and examples and made some progress creating a QT GUI. However, I got hopelessly stuck at implementing an operation that reads from the file (that is simple) and puts the read text in a text widget (this is hard).

I tried to follow: http://doc.qt.io/qt-4.8/gettingstartedqt.html

Shinmera commented 7 years ago

Is QTextEdit::setText not good enough or what exactly is the problem?

Short example:

(with-main-window (w (q+:make-qtextedit))
  (let ((path (q+:qfiledialog-get-open-file-name)))
    (when (string/= path "")
      (setf (q+:text w) (alexandria:read-file-into-string (uiop:parse-native-namestring path))))))
phoe commented 7 years ago

@bigos https://github.com/bigos/qtools-testdrive/issues/1

bigos commented 7 years ago

Because my widget was wrapped inside a layout, not like in your example, I had problems accessing the instance of text-edit. While your simple example works, translating QT documentation to qtools is sometimes not obvious for a new user.

Shinmera commented 7 years ago

Well, define-subwidget, which I assume you used to define the text edit, states:

a finalized slot of NAME is added to WIDGET-CLASS

Thus it should be obvious that you can retrieve the instance through slot-value or with-slots-bound. Qtools' documentation is not meant to be an introduction to Qt or Lisp in general.

bigos commented 7 years ago

I am not that good with CLOS and the quoted text doesn't make it obvious to me. Do you think I would be better off using only CommonQT for now and move to Qtools only when I get more familiar with QT?

Shinmera commented 7 years ago

I generally don't think that using CommonQt over Qtools would help in learning to use Qt or CL.

bigos commented 7 years ago

So, I will just keep trying with Qtools and occasionally will ask you a question. Problem solved!

Shinmera commented 7 years ago

Sure. As phoe mentioned in the other thread, the IRC channels will be available for questions as well.