Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. I dont know the apropriate Class of QT.
Qt 6.11 is out! See what's new in the release blog

I dont know the apropriate Class of QT.

Scheduled Pinned Locked Moved General and Desktop
12 Posts 5 Posters 3.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xmaze
    wrote on last edited by
    #3

    i am not sure, i need some thing like this,

    http://gpredict.oz9aec.net/screenshots.php

    but only for Europe. a simple program not navigation and etc.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Hi,

      Something like google map's pin ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xmaze
        wrote on last edited by
        #5

        [quote author="SGaist" date="1421096731"]Hi,

        Something like google map's pin ?[/quote]

        is it offline? i think it's working only online.

        how can i use a picture as a background with Qt.
        Then i can use some maths to calculate the position on the picture.
        if the image is an array [x][y] then i can convert the coordinates as a pixel position.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #6

          You can do that with a QLabel however the picture of a map can be quite big.

          "Marble":https://marble.kde.org/index.php might be an alternative

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • X Offline
            X Offline
            xmaze
            wrote on last edited by
            #7

            i tried last night the Class QGraphicsView and QGraphicsScene.
            Is that right ? but i have a problem, why the picture is not at corner ?
            see please thee screen-shot to understand.
            !http://i60.tinypic.com/29nb11f.png!

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #8

              How can we judge that if you're now showing your code?
              However, just putting up a map as an image won't help you much in your quest to put things at specific coordinates on that map. You will need to deal with the projection for that, and you don't have control over that if you use an image.

              1 Reply Last reply
              0
              • K Offline
                K Offline
                kenchan
                wrote on last edited by
                #9

                one possibility...
                Viewport Anchor set to AnchorViewCenter

                As Andre says you should show some code I think.

                1 Reply Last reply
                0
                • X Offline
                  X Offline
                  xmaze
                  wrote on last edited by
                  #10

                  Sorry i forgot the code
                  @
                  QGraphicsScene scene;
                  scene.setSceneRect(-300, -300, 600, 600);
                  //! [1] //! [2]
                  scene.setItemIndexMethod(QGraphicsScene::NoIndex);
                  scene.addItem(point);
                  //! [4]
                  QGraphicsView view(&scene);
                  view.setRenderHint(QPainter::Antialiasing);
                  view.setBackgroundBrush(QImage(":/images/map.jpg"));
                  //! [4] //! [5]
                  view.setCacheMode(QGraphicsView::CacheBackground);
                  view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
                  view.setDragMode(QGraphicsView::ScrollHandDrag);
                  //! [5] //! [6]
                  view.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Europe map test"));
                  view.resize(400, 300);
                  view.show();
                  @

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kenchan
                    wrote on last edited by
                    #11

                    if you change scene.setSceneRect(-300, -300, 600, 600);
                    scene.setSceneRect(0, 0, 600, 600); your image should align with the top left corner if that is what you want.

                    1 Reply Last reply
                    0
                    • X Offline
                      X Offline
                      xmaze
                      wrote on last edited by
                      #12

                      [quote author="kenchan" date="1421154626"]if you change scene.setSceneRect(-300, -300, 600, 600);
                      scene.setSceneRect(0, 0, 600, 600); your image should align with the top left corner if that is what you want.

                      [/quote]
                      i make this @
                      QGraphicsScene scene;
                      scene.setSceneRect(0,0, QImage(":/images/map.jpg").width(), QImage(":/images/map.jpg").height());@

                      it looks very good
                      Thnx

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved