| 1915 | } |
| 1916 | |
| 1917 | void ShaderViewer::variables_contextMenu(const QPoint &pos) |
| 1918 | { |
| 1919 | QAbstractItemView *w = qobject_cast<QAbstractItemView *>(QObject::sender()); |
| 1920 | |
| 1921 | QMenu contextMenu(this); |
| 1922 | |
| 1923 | QAction copyValue(tr("Copy"), this); |
| 1924 | QAction addWatch(tr("Add Watch"), this); |
| 1925 | QAction deleteWatch(tr("Delete Watch"), this); |
| 1926 | QMenu interpretMenu(tr("Interpret As..."), this); |
| 1927 | QAction clearAll(tr("Clear All"), this); |
| 1928 | |
| 1929 | QAction interpDefault(tr("Default"), this); |
| 1930 | QAction interpFloat(tr("Floating point"), this); |
| 1931 | QAction interpSInt(tr("Signed decimal"), this); |
| 1932 | QAction interpUInt(tr("Unsigned decimal"), this); |
| 1933 | QAction interpHex(tr("Unsigned hexadecimal"), this); |
| 1934 | QAction interpOctal(tr("Unsigned octal"), this); |
| 1935 | QAction interpBinary(tr("Unsigned binary"), this); |
| 1936 | QAction interpColor(tr("Float RGB color"), this); |
| 1937 | |
| 1938 | interpDefault.setCheckable(true); |
| 1939 | interpFloat.setCheckable(true); |
| 1940 | interpSInt.setCheckable(true); |
| 1941 | interpUInt.setCheckable(true); |
| 1942 | interpHex.setCheckable(true); |
| 1943 | interpOctal.setCheckable(true); |
| 1944 | interpBinary.setCheckable(true); |
| 1945 | interpColor.setCheckable(true); |
| 1946 | |
| 1947 | interpretMenu.addAction(&interpDefault); |
| 1948 | interpretMenu.addAction(&interpFloat); |
| 1949 | interpretMenu.addAction(&interpSInt); |
| 1950 | interpretMenu.addAction(&interpUInt); |
| 1951 | interpretMenu.addAction(&interpHex); |
| 1952 | interpretMenu.addAction(&interpOctal); |
| 1953 | interpretMenu.addAction(&interpBinary); |
| 1954 | interpretMenu.addAction(&interpColor); |
| 1955 | |
| 1956 | contextMenu.addAction(©Value); |
| 1957 | contextMenu.addSeparator(); |
| 1958 | contextMenu.addAction(&addWatch); |
| 1959 | |
| 1960 | if(QObject::sender() == ui->watch) |
| 1961 | { |
| 1962 | QObject::connect(©Value, &QAction::triggered, [this] { ui->watch->copySelection(); }); |
| 1963 | |
| 1964 | contextMenu.addMenu(&interpretMenu); |
| 1965 | contextMenu.addAction(&deleteWatch); |
| 1966 | contextMenu.addSeparator(); |
| 1967 | contextMenu.addAction(&clearAll); |
| 1968 | |
| 1969 | // start with no row selected |
| 1970 | RDTreeWidgetItem *item = ui->watch->selectedItem(); |
| 1971 | |
| 1972 | int topLevelIdx = ui->watch->indexOfTopLevelItem(item); |
| 1973 | |
| 1974 | // last top level item is the empty entry for adding new values, it's not valid |
nothing calls this directly
no test coverage detected