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 set needed permission so I can edit qt headers from qt creator?
Forum Updated to NodeBB v4.3 + New Features

How to set needed permission so I can edit qt headers from qt creator?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 494 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.
  • J Offline
    J Offline
    JacobNovitsky
    wrote on last edited by
    #1

    How to set needed permission so I can edit qt headers from qt creator?
    i can do that from text editor
    chmod +x or chmod + 777 did not helpq.png

    1 Reply Last reply
    0
    • Paul ColbyP Offline
      Paul ColbyP Offline
      Paul Colby
      wrote on last edited by
      #2

      Hi @JacobNovitsky,

      How to set needed permission so I can edit qt headers from qt creator?

      Well, first off, you shouldn't! Editing those files can very easily cause strange and hard-to-trace failures in your application as the headers no longer match the Qt libraries you'll be linking against. That you don't already know how to change those permissions suggests that you shouldn't be doing it.

      That said, for the sake of answering the question... if you must then:

      sudo chmod a+w /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qmainwindow.h
      

      But again, I strongly recommend against it.

      Out of curiosity, why do you want to do this?

      Cheers.

      J 1 Reply Last reply
      1
      • Paul ColbyP Paul Colby

        Hi @JacobNovitsky,

        How to set needed permission so I can edit qt headers from qt creator?

        Well, first off, you shouldn't! Editing those files can very easily cause strange and hard-to-trace failures in your application as the headers no longer match the Qt libraries you'll be linking against. That you don't already know how to change those permissions suggests that you shouldn't be doing it.

        That said, for the sake of answering the question... if you must then:

        sudo chmod a+w /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qmainwindow.h
        

        But again, I strongly recommend against it.

        Out of curiosity, why do you want to do this?

        Cheers.

        J Offline
        J Offline
        JacobNovitsky
        wrote on last edited by
        #3

        @Paul-Colby hi, thanks for reply
        you can refer to other question for today, I want to make chain of headers pre-compiled to reduced building/compilation time

        C 1 Reply Last reply
        0
        • J JacobNovitsky

          @Paul-Colby hi, thanks for reply
          you can refer to other question for today, I want to make chain of headers pre-compiled to reduced building/compilation time

          C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #4

          @JacobNovitsky said in How to set needed permission so I can edit qt headers from qt creator?:

          I want to make chain of headers pre-compiled to reduced building/compilation time

          This absolutely does not require any modification of header files outside your own project's files (and generally not even those).

          J 1 Reply Last reply
          1
          • C ChrisW67

            @JacobNovitsky said in How to set needed permission so I can edit qt headers from qt creator?:

            I want to make chain of headers pre-compiled to reduced building/compilation time

            This absolutely does not require any modification of header files outside your own project's files (and generally not even those).

            J Offline
            J Offline
            JacobNovitsky
            wrote on last edited by
            #5

            @ChrisW67 As I understood guides and youtube videos:

            [1] set needed headers to pro.file below lines

            PRECOMPILED_HEADER  = Static_lib.h \
            /home/supernova/Qt/6.2.4/Src/qtbase/include/QtWidgets/QDialog
            /home/supernova/Qt/6.2.4/Src/qtbase/include/QtWidgets/QStandardItemModel
            /home/supernova/Qt/6.2.4/Src/qtbase/include/QtWidgets/QMainWindow
            /home/supernova/Qt/6.2.4/Src/qtbase/include/QtWidgets/QWidget
            

            [2] each header and inner header needs to get wrapped like this

            #pragma once
            #ifndef QDIALOG_H
            #define QDIALOG_H
            #if defined __cplusplus
            #include <QtWidgets/qtwidgetsglobal.h>
            #include <QtWidgets/qwidget.h>
            #endif
            QT_REQUIRE_CONFIG(dialog);
            #pragma once
            
            C 1 Reply Last reply
            0
            • J JacobNovitsky

              @ChrisW67 As I understood guides and youtube videos:

              [1] set needed headers to pro.file below lines

              PRECOMPILED_HEADER  = Static_lib.h \
              /home/supernova/Qt/6.2.4/Src/qtbase/include/QtWidgets/QDialog
              /home/supernova/Qt/6.2.4/Src/qtbase/include/QtWidgets/QStandardItemModel
              /home/supernova/Qt/6.2.4/Src/qtbase/include/QtWidgets/QMainWindow
              /home/supernova/Qt/6.2.4/Src/qtbase/include/QtWidgets/QWidget
              

              [2] each header and inner header needs to get wrapped like this

              #pragma once
              #ifndef QDIALOG_H
              #define QDIALOG_H
              #if defined __cplusplus
              #include <QtWidgets/qtwidgetsglobal.h>
              #include <QtWidgets/qwidget.h>
              #endif
              QT_REQUIRE_CONFIG(dialog);
              #pragma once
              
              C Offline
              C Offline
              ChrisW67
              wrote on last edited by ChrisW67
              #6

              @JacobNovitsky Just follow the example in the documentation

              Project file. Only 2 lines added

              QT       += core gui
              greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
              CONFIG += c++17
              
              # You can make your code fail to compile if it uses deprecated APIs.
              # In order to do so, uncomment the following line.
              #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
              
              CONFIG += precompile_header
              PRECOMPILED_HEADER = precompiled.h
              
              SOURCES += \
                  main.cpp \
                  widget.cpp
              
              HEADERS += \
                  widget.h
              
              # Default rules for deployment.
              qnx: target.path = /tmp/$${TARGET}/bin
              else: unix:!android: target.path = /opt/$${TARGET}/bin
              !isEmpty(target.path): INSTALLS += target
              

              Headers to be precompiled (precompiled.h):

              // Add C includes here
              
              // none in this example
              
              #if defined __cplusplus
              
              // Add stable C++ includes here
              #include <QApplication>
              #include <QPushButton>
              #include <QLabel>
              #include <QLineEdit>
              
              #endif
              

              And the unmodified code of the program:

              #ifndef WIDGET_H
              #define WIDGET_H
              
              #include <QWidget>
              
              class Widget : public QWidget
              {
                  Q_OBJECT
              
              public:
                  Widget(QWidget *parent = nullptr);
                  ~Widget();
              };
              #endif // WIDGET_H
              
              #include "widget.h"
              
              #include <QLabel>
              #include <QPushButton>
              #include <QLineEdit>
              #include <QVBoxLayout>
              
              
              Widget::Widget(QWidget *parent)   
                  : QWidget(parent) 
              {
                  QVBoxLayout *layout = new QVBoxLayout(this);
                  QLabel *label = new QLabel("Hello, world!");
                  QPushButton *button = new QPushButton("Hello, button!");
                  QLineEdit *edit = new QLineEdit("Hello, editor!");
                  layout->addWidget(label);
                  layout->addWidget(button);
                  layout->addWidget(edit);
               }
              
              Widget::~Widget() { }
              
              #include "widget.h"
              #include <QApplication>
              
              int main(int argc, char *argv[])
              {
                  QApplication a(argc, argv);
                  Widget w;
                  w.show();
                  return a.exec();
              }
              

              Re-run qmake, build, and precompiling/using the headers will happen. Any header not in the precompiled set will be handled normally.

              1 Reply Last reply
              2
              • Christian EhrlicherC Christian Ehrlicher referenced this topic on
              • Christian EhrlicherC Christian Ehrlicher referenced this topic on
              • Christian EhrlicherC Christian Ehrlicher referenced this topic on

              • Login

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