小编eyl*_*esc的帖子

多继承元类冲突

我需要一个类的双重继承.我尝试了几种语法,但我不理解元类的概念.

from PyQt5.QtGui import QStandardItem
from configparser import ConfigParser

class FinalClass(ConfigParser, QStandardItem):
    def __init__(self, param):
        ConfigParser.__init__(self)
        QStandardItem.__init__(self)
Run Code Online (Sandbox Code Playgroud)

python pyqt multiple-inheritance python-3.x pyqt5

9
推荐指数
2
解决办法
5341
查看次数

运行Android检测测试时出现"未找到测试"错误

我是测试的初学者.我在android studio中为登录活动创建了一个简单的测试用例.但我得到了一个错误,我无法解决它.这是我的测试代码.帮助将非常感激.

package com.example.hassidiczaddic.testinglist;

import android.app.Application;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.ActivityInstrumentationTestCase2;
import android.test.ApplicationTestCase;
import android.test.suitebuilder.annotation.LargeTest;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class ApplicationTest {

    public static final String STRING_TO_BE_TYPED = "Wolfmatrix";

    @Rule
    public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class);

    @Test
    public void LoginActivity() {
        onView(withId(R.id.etFName))
                .perform(typeText(STRING_TO_BE_TYPED), closeSoftKeyboard());
        onView(withId(R.id.etLName))
                .perform(typeText(STRING_TO_BE_TYPED), closeSoftKeyboard());
        onView(withId(R.id.btnSubmit))
            .perform(click());
        onView(withId(R.id.tvView))
            .check(matches(withText(STRING_TO_BE_TYPED))); …
Run Code Online (Sandbox Code Playgroud)

android junit4 android-studio android-espresso

9
推荐指数
1
解决办法
4878
查看次数

飞路异常,检测到失败的迁移

我有一个Flyway例外:

FlywayException: Detected failed migration to version 1.0
Run Code Online (Sandbox Code Playgroud)

我寻找文档和论坛,但我没有找到什么意味着这个例外.请有人告诉我这些例外的原因是什么!谢谢

database flyway

9
推荐指数
2
解决办法
9590
查看次数

qt.qpa.plugin:无法加载“”中的Qt平台插件“wayland”,即使已找到

我正在使用 Ubuntu 20.04.3 并尝试一些基于 QT 的应用程序。在我的特定用例中,我尝试启动 Android 文件传输,但它抛出以下错误:

    Failed to create wl_display (No such file or directory)
    qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
Run Code Online (Sandbox Code Playgroud)

这是“qmake --version”的输出

    QMake version 3.1
    Using Qt version 5.9.7 in /home/*****/anaconda3/lib
Run Code Online (Sandbox Code Playgroud)

这是停用 …

qt qt5 ubuntu-20.04

9
推荐指数
1
解决办法
1万
查看次数

QTreeWidgetItem中的QComboBox

是否有类似于(PyQT)的东西, QTreeWidgetItem.setCheckState(0, Qt.Checked)但对于组合框?

我在参考文献中看不到任何内容,那么如何在QTreeWidgetItem中插入自定义QComboBox作为其中一个元素?

qt qt4 pyqt pyqt4

8
推荐指数
2
解决办法
2万
查看次数

qml中垂直Listview内的水平listView

我想使一个水平listView作为另一个veritcal listView的委托,我写了下面的代码:

import Qt 4.7

Item {
    id:main
    width: 360
    height: 640

    Component{
        id:myDelegate
            ListView{
                id:list2
                spacing: 5
                width:list.width
                height:list.height/3
                interactive: true
                orientation: ListView.Horizontal
                model: ListModel {
                    ListElement {
                        name: "Bill Smith"
                        number: "555 3264"
                    }
                    ListElement {
                        name: "John Brown"
                        number: "555 8426"
                    }
                    ListElement {
                        name: "Sam Wise"
                        number: "555 0473"
                    }

                    ListElement {
                        name: "Sam Wise"
                        number: "555 0473"
                    }

                    ListElement {
                        name: "Sam Wise"
                        number: "555 0473"
                    }
                }
                delegate: Text{text:name
                width: main.width/3}

                focus: true
                MouseArea …
Run Code Online (Sandbox Code Playgroud)

qt qt4 qml

8
推荐指数
2
解决办法
7726
查看次数

如何模拟QML组件

实际上我正在尝试对嵌入C++对象QML组件进行一些测试.不幸的是,当我执行测试时,我遇到了一些错误.QML文件无法识别C++对象.这也很有意义,因为在main.cpp文件中设置了C++对象.

我的问题是:我如何模拟上下文属性来执行QML测试?或者其他人说,我怎样才能用混合Qt/QML代码进行单元测试?

c++ unit-testing mocking qml qt5

8
推荐指数
1
解决办法
1397
查看次数

QDataWidgetMapper不能与QLabels一起使用

我正在使用QDataWidgetMapper将数据映射到QLineEdit,它工作正常.当我使用将数据映射到QLabel时,它不会在标签中显示任何数据.我正在尝试以下列方式执行此操作:

QDataWidgetMapper *testMapper=new QDataWidgetMapper();

testMapper->setOrientation(Qt::Vertical);
testMapper->setModel(testModel);


//setting the mapper values to the textboxes ----works fine
testMapper->addMapping(ui->LineEdit1,0);
testMapper->addMapping(ui->LineEdit2,1);

//setting it to qlabels
testMapper->addMapping(ui->label,3);----- does not work
testMapper->toFirst();
Run Code Online (Sandbox Code Playgroud)

我从列表中获取值并将列表附加到QDataWidgetMapper,从mapper我使用addMapping将其附加到文本框.任何人都可以让我知道为什么它不适用于qLabels.

qt qt4 qt-creator

8
推荐指数
1
解决办法
1110
查看次数

QML如何绘制不同于grabToImage()

是否有任何可能的方法使grabToImage()缓冲区与GUI中显示的不同?我ChartView在GUI中使用没有图例,并希望将其导出为PNG图例.所以我尝试:

chartView.legend.visible = true
chartView.update()
chartView.grabToImage(function(result) {
    console.log("grabbed")

    var path = filename.toString().replace(/^(file:\/{2})/,"");
    console.log(path + result.saveToFile(path));
    chartView.legend.visible = false
    update();
});
Run Code Online (Sandbox Code Playgroud)

但是这些更新只有在控件出来之后才会发生,因此我不会在PNG中绘制传奇.另外,我希望图例的外观对用户来说是不可察觉的.在QML中有没有办法做到这一点?

qt qml

8
推荐指数
1
解决办法
952
查看次数

使用其有状态小部件访问状态类的方法?

我在 state 类中有一个方法,但我需要使用它的小部件类引用在外部访问该方法,

class TestFormState extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _testState();
  }
}

class _testFormState extends State<TestFormState> {
  int count = 1;

  @override
  Widget build(BuildContext context) {
    return Center(
        child: Container(
        color: Colors.green,
            child: Text("Count : $count"),
        ),
    );
  }

  clickIncrease(){
    setState(() { count += 1; });
  }
}
Run Code Online (Sandbox Code Playgroud)

我需要在另一个小部件中访问上述小部件的 clickIncrease,如下面的代码,

class TutorialHome extends StatelessWidget {

    TestFormState test;

  @override
  Widget build(BuildContext context) {
    // Scaffold is a layout for the major Material Components.
    return Scaffold(
      body: Column( …
Run Code Online (Sandbox Code Playgroud)

dart flutter

8
推荐指数
2
解决办法
3868
查看次数