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. QDialog in Windows haven't icon in taskbar
Forum Updated to NodeBB v4.3 + New Features

QDialog in Windows haven't icon in taskbar

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 4 Posters 1.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.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on last edited by
    #5

    @SGaist said in QDialog in Windows haven't icon in taskbar:

    Correct

    Yes, it is correct

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

      Please provide a minimal runnable script that shows your issue.

      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
      • M Offline
        M Offline
        Mikeeeeee
        wrote on last edited by Mikeeeeee
        #7

        I create QAplication, create object class with Qwidget (this class QDialog), show QDialog (QWidget is hiden)

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

          As I already requested: please provide a minimal runnable script that shows that behaviour.

          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
          • M Offline
            M Offline
            Mikeeeeee
            wrote on last edited by
            #9
            if __name__ == '__main__':
                # print(sys.argv)
                minicondaPath = "../../miniconda3"
                if len(sys.argv) >= 2:
                    minicondaPath = sys.argv[1]
                default_qgis_path = '/usr'
                conda_prefix = os.environ.get('CONDA_PREFIX')
                if conda_prefix is not None:
                    default_qgis_path = conda_prefix
                    import platform
                    if platform.system() == 'Windows':
                        default_qgis_path = os.path.join(default_qgis_path, 'Library')
            
                app = QgsApplication([], True)
                app.setPrefixPath(os.environ.get('QGISPATH', default_qgis_path), True)
                app.initQgis()
            
                mainWindow = MainWindow(app)
                mainWindow.configOS.setMinicondaPath(minicondaPath)
                boolEnter = mainWindow.dialogRegistrationFunction()
                if boolEnter == None:
                    boolEnter = True
            
                if boolEnter:
                    app.exec()
            
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #10

              You know that this is neither a minimal nor runnable script that shows your issue ?

              There's no definition of MainWindow.
              It requires an installation of QGIS
              You are using a conda environment somewhere but it's not clear whether your script runs within it or just makes use of it at some point.

              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
              1
              • M Offline
                M Offline
                Mikeeeeee
                wrote on last edited by
                #11
                from PyQt5 import QtCore, QtGui, QtWidgets, uic
                
                from PyQt5 import Qt
                from PyQt5.QtCore import QObject, QAbstractTableModel, QSortFilterProxyModel, QAbstractItemModel, QFile, QIODevice, QDir, QVariant, pyqtSignal, QPoint, QDateTime
                from PyQt5.QtCore import QSettings, QUrl, QCoreApplication, QThread, QRect, QTimer, QDateTime, QEvent, QSize
                from PyQt5.QtWidgets import QMainWindow, QDialog, QFileDialog, QLineEdit, QTextEdit, QToolBar, QAction, QDialogButtonBox, QFormLayout, QMessageBox, QDockWidget, QApplication
                from PyQt5.QtWidgets import QVBoxLayout, QHBoxLayout, QGridLayout, QWidget, QLabel, QPushButton, QGroupBox, QSpacerItem, QDesktopWidget, QStyle, QShortcut, QItemDelegate, QStyledItemDelegate
                from PyQt5.QtWidgets import QSlider, QCheckBox
                from PyQt5.QtGui import QColor, QMouseEvent, QIcon, QPixmap, QFont, QPalette, QImage, QBrush, QCursor, QMouseEvent
                import sys
                
                class MainClass(QWidget):
                    def __init__(self):
                        super(MainClass, self).__init__()
                
                    def dialogRegistrationFunction(self):
                        self.dialogRegistration = QDialog(self)
                        self.dialogRegistration.setWindowModality(QtCore.Qt.ApplicationModal)
                        self.dialogRegistration.setWindowTitle("Авторизация")
                        self.dialogRegistration.setWindowFlag(QtCore.Qt.FramelessWindowHint)
                        self.dialogRegistration.setFixedWidth(420)
                        self.dialogRegistration.setMinimumHeight(520)
                
                        styleSheet = self.dialogRegistration.styleSheet()
                        styleSheet += "; background-color: rgb(16,40,84); border-image: url(./images/Fon2.png) stretch;"
                        self.dialogRegistration.setStyleSheet(styleSheet)
                        styleSheet.replace("; background-color: rgb(16,40,84); border-image: url(./images/Fon2.png) stretch;", "")
                
                
                        lineEditName = QLineEdit()
                        lineEditName.setPlaceholderText("Имя")
                        lineEditName.setFixedWidth(250)
                        lineEditName.setStyleSheet(
                            "background-color: rgb(16,40,84); border-image: url(./images/________.png) stretch; font: 15;")
                        lineEditPassword = QLineEdit()
                        lineEditPassword.setPlaceholderText("Пароль")
                        lineEditPassword.setFixedWidth(lineEditName.width())
                        lineEditPassword.setEchoMode(QLineEdit.Password)
                        lineEditPassword.setStyleSheet(
                            "background-color: rgb(16,40,84); border-image: url(./images/________.png) stretch; font: 15;")
                
                        checkBox = QCheckBox()
                        checkBox.setText("Показать пароль")
                        checkBox.setStyleSheet(
                            "background-color: rgb(16,40,84); border-image: url(./images/________.png) stretch; ")
                
                        def onCheckBoxStateChanged(state):
                            if state == 0:
                                lineEditPassword.setEchoMode(QLineEdit.Password)
                            else:
                                lineEditPassword.setEchoMode(QLineEdit.Normal)
                
                        checkBox.stateChanged.connect(onCheckBoxStateChanged)
                
                        self.flagEnterDomainUser = False
                
                        def onPushButtonDomainUserClicked():
                            self.dialogRegistration.hide()
                            self.flagEnterDomainUser = self.enterDomainUser()
                
                        pushButtonDomainUser = QPushButton()
                        pushButtonDomainUser.setStyleSheet(
                            "background-color: rgb(16,40,84); border-image: url(./images/________.png) stretch;")
                        pushButtonDomainUser.setText("Войти как доменный пользователь")
                        fontButtonDomainUser = QFont()
                        fontButtonDomainUser.setPixelSize(12)
                        pushButtonDomainUser.setFont(fontButtonDomainUser)
                        pushButtonDomainUser.hide()
                
                        buttonBox = QDialogButtonBox()
                        buttonBox.setCenterButtons(True)
                        # buttonBox.setStyleSheet(styleSheet)
                        buttonBox.setStyleSheet("background-color: rgb(16,40,84); border-image: url(./images/________.png) stretch;")
                
                        buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
                        buttonBox.button(QDialogButtonBox.Ok).setText("Войти")
                        # buttonBox.button(QDialogButtonBox.Ok).setText("       ")
                        buttonBox.button(QDialogButtonBox.Cancel).setText("Отмена")
                        buttonBox.accepted.connect(self.dialogRegistration.accept)
                        buttonBox.rejected.connect(self.dialogRegistration.reject)
                
                        buttonBox.button(QDialogButtonBox.Ok).setStyleSheet(
                            ";background-color: rgb(0,155,221); border-image: url(./images/________.png) stretch; ")
                        buttonBox.button(QDialogButtonBox.Cancel).setStyleSheet(
                            ";background-color: rgb(16,40,84); border-image: url(./images/________.png) stretch;  ")
                        fontButton = QFont()
                        fontButton.setPixelSize(17)
                        widthButton = 110
                        buttonBox.button(QDialogButtonBox.Ok).setFont(fontButton)
                        buttonBox.button(QDialogButtonBox.Cancel).setFont(fontButton)
                        buttonBox.button(QDialogButtonBox.Ok).setFixedWidth(widthButton)
                        buttonBox.button(QDialogButtonBox.Cancel).setFixedWidth(widthButton)
                        buttonBox.button(QDialogButtonBox.Ok).setIcon(QIcon(""))
                        buttonBox.button(QDialogButtonBox.Cancel).setIcon(QIcon(""))
                
                        fontLineEdit = QFont()
                        fontLineEdit.setPixelSize(17)
                        lineEditName.setFont(fontLineEdit)
                        lineEditPassword.setFont(fontLineEdit)
                
                        # layout = QFormLayout()
                        layoutY = QVBoxLayout()
                        layoutY.addSpacing(380)
                
                        hLayout1 = QHBoxLayout()
                        spacing1 = int((self.dialogRegistration.width() - lineEditName.width()) / 2 - 10)
                        # hLayout1.addSpacing(spacing1)
                        hLayout1.addWidget(lineEditName)
                        layoutY.addLayout(hLayout1)
                        hLayout2 = QHBoxLayout()
                        # hLayout2.addSpacing(spacing1)
                        hLayout2.addWidget(lineEditPassword)
                        layoutY.addLayout(hLayout2)
                        hLayout3 = QHBoxLayout()
                        hLayout3.addSpacing(spacing1)
                        hLayout3.addWidget(checkBox)
                        layoutY.addLayout(hLayout3)
                        # layoutY.addSpacing(5)
                        hLayout4 = QHBoxLayout()
                        hLayout4.addSpacing(spacing1)
                        hLayout4.addWidget(pushButtonDomainUser)
                        hLayout4.addSpacing(spacing1)
                        layoutY.addLayout(hLayout4)
                        layoutY.addWidget(buttonBox)
                        layoutY.addSpacing(20)
                
                        self.dialogRegistration.setLayout(layoutY)
                
                        if self.dialogRegistration.exec() == QDialog.Accepted:
                            return True
                
                        else:
                            return False
                
                if __name__ == '__main__':
                    app = QApplication(sys.argv)
                    mainClass = MainClass()
                    mainClass.dialogRegistrationFunction()
                    app.exec()
                
                    app.quit()
                
                jsulmJ 1 Reply Last reply
                0
                • M Mikeeeeee
                  from PyQt5 import QtCore, QtGui, QtWidgets, uic
                  
                  from PyQt5 import Qt
                  from PyQt5.QtCore import QObject, QAbstractTableModel, QSortFilterProxyModel, QAbstractItemModel, QFile, QIODevice, QDir, QVariant, pyqtSignal, QPoint, QDateTime
                  from PyQt5.QtCore import QSettings, QUrl, QCoreApplication, QThread, QRect, QTimer, QDateTime, QEvent, QSize
                  from PyQt5.QtWidgets import QMainWindow, QDialog, QFileDialog, QLineEdit, QTextEdit, QToolBar, QAction, QDialogButtonBox, QFormLayout, QMessageBox, QDockWidget, QApplication
                  from PyQt5.QtWidgets import QVBoxLayout, QHBoxLayout, QGridLayout, QWidget, QLabel, QPushButton, QGroupBox, QSpacerItem, QDesktopWidget, QStyle, QShortcut, QItemDelegate, QStyledItemDelegate
                  from PyQt5.QtWidgets import QSlider, QCheckBox
                  from PyQt5.QtGui import QColor, QMouseEvent, QIcon, QPixmap, QFont, QPalette, QImage, QBrush, QCursor, QMouseEvent
                  import sys
                  
                  class MainClass(QWidget):
                      def __init__(self):
                          super(MainClass, self).__init__()
                  
                      def dialogRegistrationFunction(self):
                          self.dialogRegistration = QDialog(self)
                          self.dialogRegistration.setWindowModality(QtCore.Qt.ApplicationModal)
                          self.dialogRegistration.setWindowTitle("Авторизация")
                          self.dialogRegistration.setWindowFlag(QtCore.Qt.FramelessWindowHint)
                          self.dialogRegistration.setFixedWidth(420)
                          self.dialogRegistration.setMinimumHeight(520)
                  
                          styleSheet = self.dialogRegistration.styleSheet()
                          styleSheet += "; background-color: rgb(16,40,84); border-image: url(./images/Fon2.png) stretch;"
                          self.dialogRegistration.setStyleSheet(styleSheet)
                          styleSheet.replace("; background-color: rgb(16,40,84); border-image: url(./images/Fon2.png) stretch;", "")
                  
                  
                          lineEditName = QLineEdit()
                          lineEditName.setPlaceholderText("Имя")
                          lineEditName.setFixedWidth(250)
                          lineEditName.setStyleSheet(
                              "background-color: rgb(16,40,84); border-image: url(./images/________.png) stretch; font: 15;")
                          lineEditPassword = QLineEdit()
                          lineEditPassword.setPlaceholderText("Пароль")
                          lineEditPassword.setFixedWidth(lineEditName.width())
                          lineEditPassword.setEchoMode(QLineEdit.Password)
                          lineEditPassword.setStyleSheet(
                              "background-color: rgb(16,40,84); border-image: url(./images/________.png) stretch; font: 15;")
                  
                          checkBox = QCheckBox()
                          checkBox.setText("Показать пароль")
                          checkBox.setStyleSheet(
                              "background-color: rgb(16,40,84); border-image: url(./images/________.png) stretch; ")
                  
                          def onCheckBoxStateChanged(state):
                              if state == 0:
                                  lineEditPassword.setEchoMode(QLineEdit.Password)
                              else:
                                  lineEditPassword.setEchoMode(QLineEdit.Normal)
                  
                          checkBox.stateChanged.connect(onCheckBoxStateChanged)
                  
                          self.flagEnterDomainUser = False
                  
                          def onPushButtonDomainUserClicked():
                              self.dialogRegistration.hide()
                              self.flagEnterDomainUser = self.enterDomainUser()
                  
                          pushButtonDomainUser = QPushButton()
                          pushButtonDomainUser.setStyleSheet(
                              "background-color: rgb(16,40,84); border-image: url(./images/________.png) stretch;")
                          pushButtonDomainUser.setText("Войти как доменный пользователь")
                          fontButtonDomainUser = QFont()
                          fontButtonDomainUser.setPixelSize(12)
                          pushButtonDomainUser.setFont(fontButtonDomainUser)
                          pushButtonDomainUser.hide()
                  
                          buttonBox = QDialogButtonBox()
                          buttonBox.setCenterButtons(True)
                          # buttonBox.setStyleSheet(styleSheet)
                          buttonBox.setStyleSheet("background-color: rgb(16,40,84); border-image: url(./images/________.png) stretch;")
                  
                          buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
                          buttonBox.button(QDialogButtonBox.Ok).setText("Войти")
                          # buttonBox.button(QDialogButtonBox.Ok).setText("       ")
                          buttonBox.button(QDialogButtonBox.Cancel).setText("Отмена")
                          buttonBox.accepted.connect(self.dialogRegistration.accept)
                          buttonBox.rejected.connect(self.dialogRegistration.reject)
                  
                          buttonBox.button(QDialogButtonBox.Ok).setStyleSheet(
                              ";background-color: rgb(0,155,221); border-image: url(./images/________.png) stretch; ")
                          buttonBox.button(QDialogButtonBox.Cancel).setStyleSheet(
                              ";background-color: rgb(16,40,84); border-image: url(./images/________.png) stretch;  ")
                          fontButton = QFont()
                          fontButton.setPixelSize(17)
                          widthButton = 110
                          buttonBox.button(QDialogButtonBox.Ok).setFont(fontButton)
                          buttonBox.button(QDialogButtonBox.Cancel).setFont(fontButton)
                          buttonBox.button(QDialogButtonBox.Ok).setFixedWidth(widthButton)
                          buttonBox.button(QDialogButtonBox.Cancel).setFixedWidth(widthButton)
                          buttonBox.button(QDialogButtonBox.Ok).setIcon(QIcon(""))
                          buttonBox.button(QDialogButtonBox.Cancel).setIcon(QIcon(""))
                  
                          fontLineEdit = QFont()
                          fontLineEdit.setPixelSize(17)
                          lineEditName.setFont(fontLineEdit)
                          lineEditPassword.setFont(fontLineEdit)
                  
                          # layout = QFormLayout()
                          layoutY = QVBoxLayout()
                          layoutY.addSpacing(380)
                  
                          hLayout1 = QHBoxLayout()
                          spacing1 = int((self.dialogRegistration.width() - lineEditName.width()) / 2 - 10)
                          # hLayout1.addSpacing(spacing1)
                          hLayout1.addWidget(lineEditName)
                          layoutY.addLayout(hLayout1)
                          hLayout2 = QHBoxLayout()
                          # hLayout2.addSpacing(spacing1)
                          hLayout2.addWidget(lineEditPassword)
                          layoutY.addLayout(hLayout2)
                          hLayout3 = QHBoxLayout()
                          hLayout3.addSpacing(spacing1)
                          hLayout3.addWidget(checkBox)
                          layoutY.addLayout(hLayout3)
                          # layoutY.addSpacing(5)
                          hLayout4 = QHBoxLayout()
                          hLayout4.addSpacing(spacing1)
                          hLayout4.addWidget(pushButtonDomainUser)
                          hLayout4.addSpacing(spacing1)
                          layoutY.addLayout(hLayout4)
                          layoutY.addWidget(buttonBox)
                          layoutY.addSpacing(20)
                  
                          self.dialogRegistration.setLayout(layoutY)
                  
                          if self.dialogRegistration.exec() == QDialog.Accepted:
                              return True
                  
                          else:
                              return False
                  
                  if __name__ == '__main__':
                      app = QApplication(sys.argv)
                      mainClass = MainClass()
                      mainClass.dialogRegistrationFunction()
                      app.exec()
                  
                      app.quit()
                  
                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #12

                  @Mikeeeeee You think this is "minimal" script to reproduce the issue?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  M 1 Reply Last reply
                  1
                  • jsulmJ jsulm

                    @Mikeeeeee You think this is "minimal" script to reproduce the issue?

                    M Offline
                    M Offline
                    Mikeeeeee
                    wrote on last edited by
                    #13

                    @jsulm said in QDialog in Windows haven't icon in taskbar:

                    You think this is "minimal" script to reproduce the issue?

                    Yes

                    JonBJ 1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      Mikeeeeee
                      wrote on last edited by
                      #14

                      Need do this

                      self.dialogRegistration = QDialog()
                      
                      1 Reply Last reply
                      0
                      • M Mikeeeeee

                        @jsulm said in QDialog in Windows haven't icon in taskbar:

                        You think this is "minimal" script to reproduce the issue?

                        Yes

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by
                        #15

                        @Mikeeeeee
                        You are asking other people to spend their time looking through your code and figuring what might be wrong. "Minimal" essentially means "the minimum number of lines to reproduce the problem; all extraneous lines have been removed". Yes, that means to get an answer you are expected to spend some time going through what you are working on and reduce it to the minimum necessary to reproduce your problem. Yes, that takes a bit of effort. Just like you are asking other people to spend in order to help you....

                        Purely as an example, in your code why do I have to wade through lines & lines of lineEditName and lineEditPassword code, with fixed widths, stylesheets and everything else, to reproduce your question about a dialog not having an icon in the taskbar? Did you try removing them before you posted to see whether they affect the issue?

                        Good luck finding someone who will care to take the time to answer, given how much time you have taken to produce the example.

                        1 Reply Last reply
                        1

                        • Login

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