title: How should I use Material Design in Pyside6 Application?
body: <p>I have below code in my pyside 6 app</p>
  <pre><code>import sys,os
  from PySide6.QtGui import QGuiApplication
  from PySide6.QtQml import QQmlApplicationEngine, qmlRegisterType
  from PySide6.QtCore import QObject, Slot, Signal, QTimer, QUrl
  import PySide6
  
  if __name__ == &quot;__main__&quot;:
      #for error -&gt; Failed to create vertex shader(It is displaying empty window)
      os.environ['QT_QUICK_BACKEND'] = &quot;software&quot;
  
      os.environ['QT_QUICK_CONTROLS_STYLE'] = &quot;Material&quot;
      os.environ['QT_QUICK_CONTROLS_MATERIAL_THEME'] = &quot;Dark&quot;
      os.environ['QT_QUICK_CONTROLS_MATERIAL_VARIANT'] = &quot;Dense&quot;
      os.environ['QT_QUICK_CONTROLS_MATERIAL_ACCENT'] = &quot;Teal&quot;
      os.environ['QT_QUICK_CONTROLS_MATERIAL_PRIMARY'] = &quot;BlueGrey&quot;
  #    os.environ['QT_QUICK_CONTROLS_MATERIAL_FOREGROUND'] = &quot;Brown&quot;
  #    os.environ['QT_QUICK_CONTROLS_MATERIAL_BACKGROUND'] = &quot;Grey&quot;
      #==================================================
      sys.argv += ['--style', 'Material']
      #==================================================
      app = QGuiApplication(sys.argv)
      engine = QQmlApplicationEngine()
      engine.load(os.path.join(os.path.dirname(__file__), &quot;qml/main.qml&quot;))
      if not engine.rootObjects():
          sys.exit(-1)
      sys.exit(app.exec_())
  </code></pre>
  <p><strong>main.qml</strong></p>
  <pre><code>import QtQuick.Window 2.15
  import QtQuick.Controls 2.15
  import QtQuick.Controls.Material 2.15
  
  ApplicationWindow {
      id:mainWindow
      flags: Qt.Window//|Qt.FramelessWindowHint
      width: 1000
      height: 580
      visible: true
  //    Material.theme:Material.Light
  //    Material.primary: Material.color(&quot;#d81b60&quot;,Material.Shade600)
  //    Material.accent: Material.color(Material.Pink,Material.Shade800)
      Material.elevation:2
      Button{
          anchors.centerIn: parent
          Material.accent: Material.Orange
          text: &quot;Open&quot;
          width: 150
          height: 45
          onClicked: {
               mainWindow.Material.theme===Material.Light? mainWindow.Material.theme=Material.Dark: mainWindow.Material.theme=Material.Light
          }
      }
  }
  </code></pre>
  <p>I have a button in center of page but effects is appearing in x=0 and y=0,and it don't display color of primary and accent</p>
  <p><a href="https://i.stack.imgur.com/qM1bb.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qM1bb.gif" alt="enter image description here" /></a></p>
  <p><strong>Edit</strong></p>
  <p>For more infomation may be helps for understanding where is problem:</p>
  <p>I disabled using material design in my project now after running the application When I hover on button I see below on application output:</p>
  <pre><code>file:///C:/Users/MyUserName/AppData/Roaming/Python/Python39/site-packages/PySide6/qml/QtQuick/Controls/Windows/Button.qml:77:49:
   Unable to assign [undefined] to int
  </code></pre>
  <p>When I click above link(in application output) It will show code of <code>Button.qml</code></p>
  <pre><code>NativeStyle.Button {
          control: control
          x: background.x
          y: background.y
          width: background.width
          height: background.height
          useNinePatchImage: false
          overrideState: NativeStyle.StyleItem.AlwaysHovered
          opacity: control.hovered ? 1 : 0
  //*********** It will jump in below by clicking on that
          Behavior on opacity { NumberAnimation { duration: parent.transitionDuration } }
      }
  </code></pre>
  <p>When I click button application will crash.I think it is because of <code>stackview.Push(&quot;page.qml&quot;)</code> and <code>StackView</code> has animation for pushing page,I think it will crash beacuse my app has problem with animation</p>
  <p>And another thing to say:
  I installed Python 3.9.2 in <code>Program Files folder</code> but when I use <code>pip install pyside6 or ...</code> It will copy the file in <code>C:/Users/MyUserName/AppData/Roaming/Python/Python39/site-packages</code> path</p>