Results 1 to 2 of 2

Thread: Qt and Envitia (Tenet) MapLink Pro Accelerator toolkit

  1. #1
    Join Date
    Aug 2008
    Location
    Cherry Hill, NJ USA
    Posts
    61
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Qt and Envitia (Tenet) MapLink Pro Accelerator toolkit

    Has anyone used Qt with MapLink Pro's Accelerator toolkit? I would like to see a minimal example of its use with Qt.
    Thanks!

  2. #2
    Join Date
    Apr 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt and Envitia (Tenet) MapLink Pro Accelerator toolkit

    Hi, I know this is an old thread, but I just got this working myself. I found this thread while doing some searching on my own and it was no help.

    So, I thought I would reply and show what I did to make MapLink Pro 6.0 work with Qt 4.8.

    Firstly, make a custom QWidget class. Then in the widget's constructor, set the following attributes.

    Qt Code:
    1. setAttribute(Qt::WA_NoBackground, true);
    2. setAttribute(Qt::WA_NoSystemBackground, true);
    3. setAttribute(Qt::WA_PaintOnScreen, true);
    4. setAutoFillBackground(false);
    5. setAttribute(Qt::WA_OpaquePaintEvent, true);
    To copy to clipboard, switch view to plain text mode 

    You will also need to override the paintEngine function like so:
    Qt Code:
    1. QPaintEngine* paintEngine() const //Works in conjunction with WA_PaintOnScreen
    2. {
    3. return NULL;
    4. }
    To copy to clipboard, switch view to plain text mode 

    Override the paintEvent:
    Qt Code:
    1. void QMapView::paintEvent(QPaintEvent *)
    2. {
    3. if (m_bInitialUpdate) //Set to true in constructor
    4. {
    5. MainWindow* main = static_cast<MainWindow*>(parentWidget()->parentWidget());
    6. if (main)
    7. {
    8. HWND hWnd = (HWND)winId();
    9. m_drawingSurface = new TSLNTSurface(hWnd, false);
    10. m_drawingSurface->setOption( TSLOptionDoubleBuffered, true ) ;
    11. m_drawingSurface->wndResize( 0, 0, rect().width(), rect().height() ) ;
    12.  
    13. m_drawingSurface->addDataLayer(main->m_dataLayer, "map");
    14. m_drawingSurface->addDataLayer(main->m_stdDataLayer, "overlay"); //Not needed if you don't want an overlay
    15. m_drawingSurface->reset(false);
    16. m_bMapLoaded = true;
    17. m_drawingSurface->setDataLayerProps( "map" , TSLPropertyBuffered , 1 ) ;
    18. }
    19.  
    20. m_bInitialUpdate = false;
    21. }
    22. if (m_drawingSurface)
    23. m_drawingSurface->drawDU(rect().left(), rect().top(), rect().right(), rect().bottom(), true, true);
    24. }
    To copy to clipboard, switch view to plain text mode 

    In our main window:
    Qt Code:
    1. TSLErrorStack::clear();
    2. TSLDrawingSurface::loadStandardConfig();
    3.  
    4. QString err(TSLErrorStack::errorString());
    5. if (!err.isNull())
    6. qDebug(qPrintable(err));
    7.  
    8. m_dataLayer = new TSLMapDataLayer();
    9. QString filename = QFileDialog::getOpenFileName(this, "Open map"); //Get a map to open
    10. m_dataLayer->loadData(filename.toStdString().c_str());
    11.  
    12. err = TSLErrorStack::errorString("Cannot load map\n");
    13. if (!err.isNull())
    14. {
    15. m_bMapLoaded = false;
    16. qDebug(qPrintable(err));
    17. }
    18. m_stdDataLayer = new TSLStandardDataLayer();
    To copy to clipboard, switch view to plain text mode 

    In the .pro file:
    Qt Code:
    1. LIBS += -L<MapLinkDirHere>/lib -lMapLink
    2. INCLUDEPATH += <MapLinkDirHere>/include
    3. DEPENDPATH += <MapLinkDirHere>/include
    To copy to clipboard, switch view to plain text mode 
    When I used -lMapLinkd, there we crashes. Using the non-debug library works fine and there still seems to be debug information available.


    This should be all you need to get MapLink to draw a map in your custom QWidget. Override methods for mouse events, resize events, keyboard events as you need.


    Make sure to include "MapLink.h" where needed!

Similar Threads

  1. accelerator key not working
    By jan in forum Qt Tools
    Replies: 4
    Last Post: 2nd October 2009, 03:30
  2. disable automatically created accelerator keys
    By joschi58 in forum Qt Programming
    Replies: 2
    Last Post: 17th January 2008, 10:50
  3. Qwt in the VS2k5 toolkit
    By ko9 in forum Qwt
    Replies: 2
    Last Post: 2nd October 2007, 16:56
  4. Diagramming Toolkit using QT
    By arjoshi in forum Newbie
    Replies: 2
    Last Post: 30th June 2007, 22:43
  5. Qt MFC Migration Toolkit
    By average in forum Qt Programming
    Replies: 0
    Last Post: 4th April 2007, 17:06

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.