qDesktopWidget.primaryScreen() doesn't exist

15 views
Skip to first unread message

Irwin Rodriguez

unread,
Mar 21, 2023, 4:47:54 PM3/21/23
to The Ring Programming Language
Hi, I was using the trick below to center a window but got an error that says: Calling Method without definition !: primaryscreen
 
image.png

I'm looking at the source code and realized the method primaryScreen actually belongs to QGuiApplication which inherits from QCoreApplication which inherits from QObject but QDesktopWidget isn't part of that inheritance chain because it comes from qWidget and that's why Ring is complaining with.

Is there any alternative to center the window?

thanks!

Mahmoud Fayed

unread,
Mar 21, 2023, 10:22:01 PM3/21/23
to The Ring Programming Language

Ilir Liburn

unread,
Mar 23, 2023, 9:39:13 PM3/23/23
to Irwin Rodriguez, The Ring Programming Language
Hello Irwin,

look under ring/documents/booksLibraryController.ring how to center the window.

You can see how PrimaryScreen was replaced also here

https://github.com/ring-lang/ring/commit/c4f275cc7e97982289b720902b7189250ebe9dea

Greetings,
Ilir


On 3/21/23, Irwin Rodriguez <rodrigu...@gmail.com> wrote:
> Hi, I was using the trick below to center a window but got an error that
> says: *Calling Method without definition !: primaryscreen*
>
> [image: image.png]
>
> I'm looking at the source code and realized the method *primaryScreen
> *actually
> belongs to* QGuiApplication* which inherits from *QCoreApplication* which
> inherits from *QObject *but *QDesktopWidget *isn't part of that inheritance
> chain because it comes from *qWidget *and that's why Ring is complaining
> with.
>
> Is there any alternative to center the window?
>
> thanks!
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "The Ring Programming Language" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ring-lang+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ring-lang/CABooBBnhtS-cdaUT2NAfVhE%3Dam%3DyvmkzUkEccxHh1tYj6UHjKA%40mail.gmail.com.
>
Reply all
Reply to author
Forward
0 new messages