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. How to correctly make the ui pointer global so that even my static functions can access it ?
Forum Updated to NodeBB v4.3 + New Features

How to correctly make the ui pointer global so that even my static functions can access it ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 238 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.
  • L Offline
    L Offline
    learnist
    wrote on last edited by
    #1

    i want to make ui pointer global , so that even my static functions can access it, This is my .h file , do i need to add something in my .cpp file as well ?

    #pragma once
    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    #include "windows.h"
    #include "windowsx.h"
    
    QT_BEGIN_NAMESPACE
    namespace Ui { class MainWindow; }
    QT_END_NAMESPACE
    
    class MainWindow : public QMainWindow
    {
        Q_OBJECT                      //Used to handle events
        Q_DISABLE_COPY(MainWindow) //added
    
    public:
        MainWindow(QWidget* parent = 0);
        ~MainWindow();                    //Destructor used to free resources
    
        // Static method that will act as a callback-function
       static LRESULT CALLBACK mouseProc(int Code, WPARAM wParam, LPARAM lParam);
    
     //   BOOL InitializeUIAutomation(IUIAutomation** automation);
    
      static Ui::MainWindow* ui; // How do i make this global ??
    
    private:
    
        // hook handler
        HHOOK mouseHook;
    };
    #endif // MAINWINDOW_H
    
    Pablo J. RoginaP 1 Reply Last reply
    0
    • L learnist

      i want to make ui pointer global , so that even my static functions can access it, This is my .h file , do i need to add something in my .cpp file as well ?

      #pragma once
      #ifndef MAINWINDOW_H
      #define MAINWINDOW_H
      #include "windows.h"
      #include "windowsx.h"
      
      QT_BEGIN_NAMESPACE
      namespace Ui { class MainWindow; }
      QT_END_NAMESPACE
      
      class MainWindow : public QMainWindow
      {
          Q_OBJECT                      //Used to handle events
          Q_DISABLE_COPY(MainWindow) //added
      
      public:
          MainWindow(QWidget* parent = 0);
          ~MainWindow();                    //Destructor used to free resources
      
          // Static method that will act as a callback-function
         static LRESULT CALLBACK mouseProc(int Code, WPARAM wParam, LPARAM lParam);
      
       //   BOOL InitializeUIAutomation(IUIAutomation** automation);
      
        static Ui::MainWindow* ui; // How do i make this global ??
      
      private:
      
          // hook handler
          HHOOK mouseHook;
      };
      #endif // MAINWINDOW_H
      
      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @learnist please don't double post. Issue is being discuss there.

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2

      • Login

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