Results 1 to 5 of 5

Thread: Using maps in QT

  1. #1
    Join Date
    Apr 2014
    Posts
    34
    Thanks
    14
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11

    Default Using maps in QT

    Hello,

    I am looking for example code and/or tutorials about rendering maps using a QT widget (like open street maps) and showing how to programmatically add points of interest to the map at specified coordinates.

    Ideally, I'd like to create an app that shows a city map with points of interest that I have listed in a database. When you click on the point of interest on the map, either a widget or map-overlay pops up with information about the PoI.

    I know how to design standard GUI using QT, but I have no clue how to start something like what I am looking for.

    TIA

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Using maps in QT

    Did you see the other thread here about QMapControl? Has a link to the web site. Looks like the control may support all that you've mentioned and will save you some work.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Apr 2014
    Posts
    34
    Thanks
    14
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Using maps in QT

    Quote Originally Posted by d_stranz View Post
    Did you see the other thread here about QMapControl? Has a link to the web site. Looks like the control may support all that you've mentioned and will save you some work.
    Thanks. It appears to have exactly what I am looking for!

  4. #4
    Join Date
    Apr 2014
    Posts
    34
    Thanks
    14
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Using maps in QT

    QMapControl is a great tool, but I've come across something I don't quite understand... it seems that QMapControl is not a complete(?) widget. If you try to use it by itself, it doesn't display itself properly; but if you embed it another widget (as all the examples do), it works fine. Is that by design?

    Examining the QMapControl class, I found that it has neither a sizeHint() overload, nor a resizeEvent() overload. Aren't those functions customarily overloaded for custom widgets?

  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Using maps in QT

    Examining the QMapControl class, I found that it has neither a sizeHint() overload, nor a resizeEvent() overload. Aren't those functions customarily overloaded for custom widgets?
    Not necessarily. Typically, if a widget is used within a layout, the layout will take responsibility for the widget's size. The sizeHint helps the layout do this by providing a recommended size. In the default implementation, an invalid size is returned. The resizeEvent eventually triggers a paintEvent, so my guess is whatever rescaling the map control does is performed in its paint event instead.

    I am not sure what you mean by "use it by itself". If you aren't embedding it in a layout or in a resizable parent, it will be created with whatever default size it has, and there isn't any way to resize it except through code. Naked QWidgets don't have size grips. They need to be embedded into a parent that does (QMainWindow, QDialog, etc.)

    Sorry for the delay in reply. Something is causing the forum URL to be inaccessible - a DNS problem, DOS attack, don't know. It's been 5 days since I was able to last access the site.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Maps API for Qt
    By Basappa in forum Installation and Deployment
    Replies: 1
    Last Post: 22nd September 2014, 09:55
  2. Using Maps without internet
    By wladek in forum Qt Quick
    Replies: 4
    Last Post: 12th July 2011, 05:34
  3. Qt & Goole Maps
    By codeman in forum Qt Programming
    Replies: 1
    Last Post: 17th June 2009, 17:34
  4. need help about calibrating scanned maps.
    By high_flyer in forum General Discussion
    Replies: 4
    Last Post: 26th July 2006, 19:27

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.